Moved everything under annotations.

Some review is still needed.
This commit is contained in:
Polonkai Gergely 2012-07-13 12:07:21 +02:00
parent 60b5eecbc8
commit 00190c3e37
41 changed files with 3264 additions and 2509 deletions

41
TODO
View File

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

View File

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

View File

@ -2,12 +2,23 @@
namespace KekRozsak\AdminBundle\Controller; namespace KekRozsak\AdminBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
/**
* @Route("/admin")
*/
class DefaultController extends Controller class DefaultController extends Controller
{ {
public function manageRegsAction($name) /**
{ * @Route("/jelentkezok", name="KekRozsakAdminBundle_manage_reg")
return $this->render('KekRozsakAdminBundle:Default:manage_regs.html.twig'); */
} 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,
));
}
} }

View File

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

View File

@ -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>

View File

@ -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%]

View File

@ -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 %}

View File

@ -2,21 +2,28 @@
namespace KekRozsak\FrontBundle\Controller; namespace KekRozsak\FrontBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use KekRozsak\FrontBundle\Form\Type\UserType; use KekRozsak\FrontBundle\Form\Type\UserType;
class DefaultController extends Controller class DefaultController extends Controller
{ {
/**
* @Route("/", name="KekRozsakFrontBundle_homepage")
*/
public function homepageAction() 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) if (!$mainPageArticle)
throw $this->createNotFoundException('A keresett cikk nem létezik!'); throw $this->createNotFoundException('A keresett cikk nem létezik!');
return $this->forward('KekRozsakFrontBundle:Default:article', array('articleSlug' => $mainPageArticle->getSlug())); return $this->forward('KekRozsakFrontBundle:Default:article', array('articleSlug' => $mainPageArticle->getSlug()));
} }
/**
* @Route("/cikk/{articleSlug}", name="KekRozsakFrontBundle_article")
*/
public function articleAction($articleSlug) public function articleAction($articleSlug)
{ {
$article = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Article')->findOneBySlug($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() public function profileEditAction()
{ {
$user = $this->get('security.context')->getToken()->getUser(); $user = $this->get('security.context')->getToken()->getUser();

View File

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

View File

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

View File

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

View File

@ -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;
}
}

View File

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

View File

@ -4,305 +4,321 @@ namespace KekRozsak\FrontBundle\Entity;
use Doctrine\ORM\Mapping as ORM; 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 * 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 class ForumTopic
{ {
/** public function __construct()
* @var integer $id {
*/ $this->posts = new \Doctrine\Common\Collections\ArrayCollection();
private $id; }
/** /**
* @var string $title * @var integer $id
*/ * @ORM\Id
private $title; * @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
private $id;
/** /**
* @var string $slug * Get id
*/ *
private $slug; * @return integer
*/
public function getId()
{
return $this->id;
}
/** /**
* @var datetime $created_at * @var string $title
*/ * @ORM\Column(type="string", length=100)
private $created_at; */
private $title;
/** /**
* @var datetime $updated_at * Set title
*/ *
private $updated_at; * @param string $title
* @return ForumTopic
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/** /**
* @var text $update_reason * Get title
*/ *
private $update_reason; * @return string
*/
public function getTitle()
{
return $this->title;
}
/** /**
* @var KekRozsak\FrontBundle\Entity\User * @var string $slug
*/ * @ORM\Column(type="string", length=100)
private $created_by; */
private $slug;
/** /**
* @var KekRozsak\FrontBundle\Entity\User * Set slug
*/ *
private $updated_by; * @param string $slug
* @return ForumTopic
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/** /**
* @var KekRozsak\FrontBundle\Entity\ForumTopicGroup * Get slug
*/ *
private $topic_group; * @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* @var datetime $createdAt
* @ORM\Column(type="datetime", name="created_at")
*/
private $createdAt;
/** /**
* Get id * Set createdAt
* *
* @return integer * @param DateTime $createdAt
*/ * @return ForumTopic
public function getId() */
{ public function setCreatedAt($createdAt)
return $this->id; {
} $this->createdAt = $createdAt;
return $this;
}
/** /**
* Set title * Get createdAt
* *
* @param string $title * @return DateTime
* @return ForumTopic */
*/ public function getCreatedAt()
public function setTitle($title) {
{ return $this->createdAt;
$this->title = $title; }
return $this;
}
/** /**
* Get title * @var User
* * @ORM\ManyToOne(targetEntity="User")
* @return string * @ORM\JoinColumn(name="created_by_id")
*/ */
public function getTitle() private $createdBy;
{
return $this->title;
}
/** /**
* Set slug * Set createdBy
* *
* @param string $slug * @param User $createdBy
* @return ForumTopic * @return ForumTopic
*/ */
public function setSlug($slug) public function setCreatedBy(\User $createdBy)
{ {
$this->slug = $slug; $this->createdBy = $createdBy;
return $this; return $this;
} }
/** /**
* Get slug * Get createdBy
* *
* @return string * @return User
*/ */
public function getSlug() public function getCreatedBy()
{ {
return $this->slug; return $this->createdBy;
} }
/** /**
* Set created_at * @var datetime $updatedAt
* * @ORM\Column(type="datetime", name="updated_at", nullable=true)
* @param datetime $createdAt */
* @return ForumTopic private $updatedAt;
*/
public function setCreatedAt($createdAt)
{
$this->created_at = $createdAt;
return $this;
}
/** /**
* Get created_at * Set updatedAt
* *
* @return datetime * @param datetime $updatedAt
*/ * @return ForumTopic
public function getCreatedAt() */
{ public function setUpdatedAt(\DateTime $updatedAt = null)
return $this->created_at; {
} $this->updatedAt = $updatedAt;
return $this;
}
/** /**
* Set updated_at * Get updatedAt
* *
* @param datetime $updatedAt * @return datetime
* @return ForumTopic */
*/ public function getUpdatedAt()
public function setUpdatedAt($updatedAt) {
{ return $this->updatedAt;
$this->updated_at = $updatedAt; }
return $this;
}
/** /**
* Get updated_at * @var User
* * @ORM\ManyToOne(targetEntity="User")
* @return datetime * @ORM\JoinColumn(name="updated_by_id")
*/ */
public function getUpdatedAt() private $updatedBy;
{
return $this->updated_at;
}
/** /**
* Set update_reason * Set updatedBy
* *
* @param text $updateReason * @param User $updatedBy
* @return ForumTopic * @return ForumTopic
*/ */
public function setUpdateReason($updateReason) public function setUpdatedBy(User $updatedBy = null)
{ {
$this->update_reason = $updateReason; $this->updatedBy = $updatedBy;
return $this; return $this;
} }
/** /**
* Get update_reason * Get updatedBy
* *
* @return text * @return User
*/ */
public function getUpdateReason() public function getUpdatedBy()
{ {
return $this->update_reason; return $this->updatedBy;
} }
/** /**
* Set created_by * @var text $updateReason
* * @ORM\Column(type="text", name="update_reason")
* @param KekRozsak\FrontBundle\Entity\User $createdBy */
* @return ForumTopic private $updateReason;
*/
public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy = null)
{
$this->created_by = $createdBy;
return $this;
}
/** /**
* Get created_by * Set updateReason
* *
* @return KekRozsak\FrontBundle\Entity\User * @param text $updateReason
*/ * @return ForumTopic
public function getCreatedBy() */
{ public function setUpdateReason($updateReason)
return $this->created_by; {
} $this->updateReason = $updateReason;
return $this;
}
/** /**
* Set updated_by * Get updateReason
* *
* @param KekRozsak\FrontBundle\Entity\User $updatedBy * @return text
* @return ForumTopic */
*/ public function getUpdateReason()
public function setUpdatedBy(\KekRozsak\FrontBundle\Entity\User $updatedBy = null) {
{ return $this->updateReason;
$this->updated_by = $updatedBy; }
return $this;
}
/** /**
* Get updated_by * @var ForumTopicGroup
* * @ORM\ManyToOne(targetEntity="ForumTopicGroup")
* @return KekRozsak\FrontBundle\Entity\User * @ORM\JoinColumn(name="topic_group_id", referencedColumnName="id")
*/ */
public function getUpdatedBy() private $topicGroup;
{
return $this->updated_by;
}
/** /**
* Set topic_group * Set topicGroup
* *
* @param KekRozsak\FrontBundle\Entity\ForumTopicGroup $topicGroup * @param ForumTopicGroup $topicGroup
* @return ForumTopic * @return ForumTopic
*/ */
public function setTopicGroup(\KekRozsak\FrontBundle\Entity\ForumTopicGroup $topicGroup = null) public function setTopicGroup(ForumTopicGroup $topicGroup)
{ {
$this->topic_group = $topicGroup; $this->topicGroup = $topicGroup;
return $this; return $this;
} }
/** /**
* Get topic_group * Get topicGroup
* *
* @return KekRozsak\FrontBundle\Entity\ForumTopicGroup * @return ForumTopicGroup
*/ */
public function getTopicGroup() public function getTopicGroup()
{ {
return $this->topic_group; return $this->topicGroup;
} }
/** /**
* @var \Doctrine\Common\Collections\ArrayCollection * @var \Doctrine\Common\Collections\ArrayCollection
*/ * @ORM\OneToMany(targetEntity="ForumPost", mappedBy="topic")
private $posts; */
private $posts;
public function __construct() /**
{ * Add posts
$this->posts = new \Doctrine\Common\Collections\ArrayCollection(); *
} * @param ForumPost $posts
* @return ForumTopic
/** */
* Add posts public function addForumPost(ForumPost $posts)
* {
* @param KekRozsak\FrontBundle\Entity\ForumPost $posts $this->posts[] = $posts;
* @return ForumTopic return $this;
*/ }
public function addForumPost(\KekRozsak\FrontBundle\Entity\ForumPost $posts)
{
$this->posts[] = $posts;
return $this;
}
/** /**
* Get posts * Get posts
* *
* @return Doctrine\Common\Collections\Collection * @return Doctrine\Common\Collections\Collection
*/ */
public function getPosts() public function getPosts()
{ {
return $this->posts; return $this->posts;
} }
/**
* @var KekRozsak\FrontBundle\Entity\ForumPost
*/
private $lastPost;
/**
* @var ForumPost
* @ORM\OneToOne(targetEntity="ForumPost", cascade={"persist"})
* @ORM\JoinColumn(name="last_post_id", referencedColumnName="id")
*/
private $lastPost;
/** /**
* Set lastPost * Set lastPost
* *
* @param KekRozsak\FrontBundle\Entity\ForumPost $lastPost * @param ForumPost $lastPost
* @return ForumTopic * @return ForumTopic
*/ */
public function setLastPost(\KekRozsak\FrontBundle\Entity\ForumPost $lastPost) public function setLastPost(ForumPost $lastPost = null)
{ {
$this->lastPost = $lastPost; $this->lastPost = $lastPost;
$this->topic_group->setLastPost($lastPost); $this->topicGroup->setLastPost($lastPost);
return $this; return $this;
} }
/** /**
* Get lastPost * Get lastPost
* *
* @return KekRozsak\FrontBundle\Entity\ForumPost * @return ForumPost
*/ */
public function getLastPost() public function getLastPost()
{ {
return $this->lastPost; return $this->lastPost;
} }
/** }
* @var KekRozsak\FrontBundle\Entity\ForumPost
*/
private $last_post;
}

View File

@ -4,292 +4,280 @@ namespace KekRozsak\FrontBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use KekRozsak\FrontBundle\Entity\User;
use KekRozsak\FrontBundle\Entity\ForumTopic;
use KekRozsak\FrontBundle\Entity\ForumPost;
/** /**
* KekRozsak\FrontBundle\Entity\ForumTopicGroup * KekRozsak\FrontBundle\Entity\ForumTopicGroup
* @ORM\Entity
* @ORM\Table(name="forum_topic_groups")
*/ */
class ForumTopicGroup class ForumTopicGroup
{ {
/** public function __construct()
* @var integer $id {
*/ $this->topic = new \Doctrine\Common\Collections\ArrayCollection();
private $id; }
/** /**
* @var string $title * @var integer $id
*/ * @ORM\Id
private $title; * @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
private $id;
/** /**
* @var string $slug * Get id
*/ *
private $slug; * @return integer
*/
public function getId()
{
return $this->id;
}
/** /**
* @var datetime $created_at * @var string $title
*/ * @ORM\Column(type="string", length=100, unique=true)
private $created_at; */
private $title;
/** /**
* @var datetime $updated_at * Set title
*/ *
private $updated_at; * @param string $title
* @return ForumTopicGroup
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/** /**
* @var text $update_reason * Get title
*/ *
private $update_reason; * @return string
*/
public function getTitle()
{
return $this->title;
}
/** /**
* @var KekRozsak\FrontBundle\Entity\User * @var string $slug
*/ * @ORM\Column(type="string", length=100, unique=true)
private $created_by; */
private $slug;
/** /**
* @var KekRozsak\FrontBundle\Entity\User * Set slug
*/ *
private $updated_by; * @param string $slug
* @return ForumTopicGroup
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/** /**
* Get id * @var datetime $createdAt
* * @ORM\Column(type="datetime", name="created_at")
* @return integer */
*/ private $createdAt;
public function getId()
{
return $this->id;
}
/** /**
* Set title * Set createdAt
* *
* @param string $title * @param DateTime $createdAt
* @return ForumTopicGroup * @return ForumTopicGroup
*/ */
public function setTitle($title) public function setCreatedAt(\DateTime $createdAt)
{ {
$this->title = $title; $this->createdAt = $createdAt;
return $this; return $this;
} }
/** /**
* Get title * Get createdAt
* *
* @return string * @return DateTime
*/ */
public function getTitle() public function getCreatedAt()
{ {
return $this->title; return $this->createdAt;
} }
/** /**
* Set slug * @var User
* * @ORM\ManyToOne(targetEntity="User")
* @param string $slug * @ORM\JoinColumn(name="created_by_id")
* @return ForumTopicGroup */
*/ private $createdBy;
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/** /**
* Get slug * Set createdBy
* *
* @return string * @param User $createdBy
*/ * @return ForumTopicGroup
public function getSlug() */
{ public function setCreatedBy(User $createdBy)
return $this->slug; {
} $this->createdBy = $createdBy;
return $this;
}
/** /**
* Set created_at * Get createdBy
* *
* @param datetime $createdAt * @return User
* @return ForumTopicGroup */
*/ public function getCreatedBy()
public function setCreatedAt($createdAt) {
{ return $this->createdBy;
$this->created_at = $createdAt; }
return $this;
}
/** /**
* Get created_at * @var datetime $updatedAt
* * @ORM\Column(type="datetime", name="updated_at", nullable=true)
* @return datetime */
*/ private $updatedAt;
public function getCreatedAt()
{
return $this->created_at;
}
/** /**
* Set updated_at * Set updatedAt
* *
* @param datetime $updatedAt * @param DateTime $updatedAt
* @return ForumTopicGroup * @return ForumTopicGroup
*/ */
public function setUpdatedAt($updatedAt) public function setUpdatedAt(\DateTime $updatedAt = null)
{ {
$this->updated_at = $updatedAt; $this->updatedAt = $updatedAt;
return $this; return $this;
} }
/** /**
* Get updated_at * Get updatedAt
* *
* @return datetime * @return datetime
*/ */
public function getUpdatedAt() public function getUpdatedAt()
{ {
return $this->updated_at; return $this->updatedAt;
} }
/** /**
* Set update_reason * @var User
* * @ORM\ManyToOne(targetEntity="User")
* @param text $updateReason * @ORM\JoinColumn(name="updated_by_id")
* @return ForumTopicGroup */
*/ private $updatedBy;
public function setUpdateReason($updateReason)
{
$this->update_reason = $updateReason;
return $this;
}
/** /**
* Get update_reason * Set updatedBy
* *
* @return text * @param User $updatedBy
*/ * @return ForumTopicGroup
public function getUpdateReason() */
{ public function setUpdatedBy(User $updatedBy = null)
return $this->update_reason; {
} $this->updatedBy = $updatedBy;
return $this;
}
/** /**
* Set created_by * Get updatedBy
* *
* @param KekRozsak\FrontBundle\Entity\User $createdBy * @return User
* @return ForumTopicGroup */
*/ public function getUpdatedBy()
public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy = null) {
{ return $this->updatedBy;
$this->created_by = $createdBy; }
return $this;
}
/** /**
* Get created_by * @var text $update_reason
* * @ORM\Column(type="text", name="update_reason", nullable=true)
* @return KekRozsak\FrontBundle\Entity\User */
*/ private $updateReason;
public function getCreatedBy()
{
return $this->created_by;
}
/** /**
* Set updated_by * Set updateReason
* *
* @param KekRozsak\FrontBundle\Entity\User $updatedBy * @param text $updateReason
* @return ForumTopicGroup * @return ForumTopicGroup
*/ */
public function setUpdatedBy(\KekRozsak\FrontBundle\Entity\User $updatedBy = null) public function setUpdateReason($updateReason = null)
{ {
$this->updated_by = $updatedBy; $this->updateReason = $updateReason;
return $this; return $this;
} }
/** /**
* Get updated_by * Get updateReason
* *
* @return KekRozsak\FrontBundle\Entity\User * @return text
*/ */
public function getUpdatedBy() public function getUpdateReason()
{ {
return $this->updated_by; return $this->updateReason;
} }
/**
* @var \Doctrine\Common\Collections\ArrayCollection
*/
private $topic;
public function __construct() /**
{ * @var ForumPost
$this->topic = new \Doctrine\Common\Collections\ArrayCollection(); * @ORM\OneToOne(targetEntity="ForumPost", cascade={"persist"})
} * @ORM\JoinColumn(name="last_post_id")
*/
/** private $lastPost;
* Add topic
*
* @param KekRozsak\FrontBundle\Entity\ForumTopic $topic
* @return ForumTopicGroup
*/
public function addForumTopic(\KekRozsak\FrontBundle\Entity\ForumTopic $topic)
{
$this->topic[] = $topic;
return $this;
}
/** /**
* Get topic * Set lastPost
* *
* @return Doctrine\Common\Collections\Collection * @param ForumPost $lastPost
*/ * @return ForumTopicGroup
public function getTopic() */
{ public function setLastPost(ForumPost $lastPost = null)
return $this->topic; {
} $this->lastPost = $lastPost;
/** return $this;
* @var \Doctrine\Common\Collections\ArrayCollection }
*/
private $topics;
/**
* Get lastPost
*
* @return ForumPost
*/
public function getLastPost()
{
return $this->lastPost;
}
/** /**
* Get topics * @var \Doctrine\Common\Collections\ArrayCollection
* * @ORM\OneToMany(targetEntity="ForumTopic", mappedBy="topicGroup")
* @return Doctrine\Common\Collections\Collection */
*/ private $topics;
public function getTopics()
{
return $this->topics;
}
/**
* @var KekRozsak\FrontBundle\Entity\ForumPost
*/
private $lastPost;
/**
/** * Get topics
* Set lastPost *
* * @return Doctrine\Common\Collections\Collection
* @param KekRozsak\FrontBundle\Entity\ForumPost $lastPost */
* @return ForumTopicGroup public function getTopics()
*/ {
public function setLastPost(\KekRozsak\FrontBundle\Entity\ForumPost $lastPost = null) return $this->topics;
{ }
$this->lastPost = $lastPost; }
return $this;
}
/**
* Get lastPost
*
* @return KekRozsak\FrontBundle\Entity\ForumPost
*/
public function getLastPost()
{
return $this->lastPost;
}
/**
* @var KekRozsak\FrontBundle\Entity\ForumPost
*/
private $last_post;
}

View File

@ -0,0 +1,261 @@
<?php
namespace KekRozsak\FrontBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* KekRozsak\FrontBundle\Entity\Group
* @ORM\Entity
* @ORM\Table(name="groups")
*/
class Group
{
/**
* @var integer $id
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
private $id;
/**
* @var string $name
* @ORM\Column(type="string", length=50, nullable=false, unique=true)
*/
private $name;
/**
* @var string $slug
* @ORM\Column(type="string", length=50, nullable=false, unique=true)
*/
private $slug;
/**
* @var datetime $createdAt
* @ORM\Column(type="datetime", name="created_at", nullable=false)
*/
private $createdAt;
/**
* @var datetime $updatedAt
* @ORM\Column(type="datetime", name="updated_at", nullable=true)
*/
private $updatedAt;
/**
* @var text $updateReason
* @ORM\Column(type="text", name="update_reason", nullable=true)
*/
private $updateReason;
/**
* @var KekRozsak\FrontBundle\Entity\User $createdBy
* @ORM\ManyToOne(targetEntity="User")
*/
private $createdBy;
/**
* @var KekRozsak\FrontBundle\Entity\User $updatedBy
* @ORM\ManyToOne(targetEntity="User")
*/
private $updatedBy;
/**
* @var KekRozsak\FrontBundle\Entity\User $leader
* @ORM\ManyToOne(targetEntity="User", inversedBy="ledGroups")
*/
private $leader;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
* @return Group
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set slug
*
* @param string $slug
* @return Group
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* Set createdAt
*
* @param datetime $createdAt
* @return Group
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return datetime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set updatedAt
*
* @param datetime $updatedAt
* @return Group
*/
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt
*
* @return datetime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* Set updateReason
*
* @param text $updateReason
* @return Group
*/
public function setUpdateReason($updateReason)
{
$this->updateReason = $updateReason;
return $this;
}
/**
* Get updateReason
*
* @return text
*/
public function getUpdateReason()
{
return $this->updateReason;
}
/**
* Set createdBy
*
* @param KekRozsak\FrontBundle\Entity\User $createdBy
* @return Group
*/
public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy = null)
{
$this->createdBy = $createdBy;
return $this;
}
/**
* Get createdBy
*
* @return KekRozsak\FrontBundle\Entity\User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* Set updatedBy
*
* @param KekRozsak\FrontBundle\Entity\User $updatedBy
* @return Group
*/
public function setUpdatedBy(\KekRozsak\FrontBundle\Entity\User $updatedBy = null)
{
$this->updatedBy = $updatedBy;
return $this;
}
/**
* Get updatedBy
*
* @return KekRozsak\FrontBundle\Entity\User
*/
public function getUpdatedBy()
{
return $this->updatedBy;
}
/**
* Set leader
*
* @param KekRozsak\FrontBundle\Entity\User $leader
* @return Group
*/
public function setLeader(\KekRozsak\FrontBundle\Entity\User $leader = null)
{
$this->leader = $leader;
return $this;
}
/**
* Get leader
*
* @return KekRozsak\FrontBundle\Entity\User
*/
public function getLeader()
{
return $this->leader;
}
/**
* @var ArrayCollection $documents
* @ORM\ManyToMany(targetEntity="Document", inversedBy="groups")
*/
private $documents;
}

View File

@ -6,238 +6,252 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* KekRozsak\FrontBundle\Entity\News * KekRozsak\FrontBundle\Entity\News
* @ORM\Entity
* @ORM\Table(name="news")
*/ */
class News class News
{ {
/** /**
* @var integer $id * @var integer $id
*/ * @ORM\Id
private $id; * @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer", name="id")
*/
private $id;
/** /**
* @var datetime $created_at * Get id
*/ *
private $created_at; * @return integer
*/
public function getId()
{
return $this->id;
}
/** /**
* @var datetime $updated_at * @var datetime $createdAt
*/ * @ORM\Column(type="datetime", name="created_at")
private $updated_at; */
private $createdAt;
/** /**
* @var text $update_reason * Set createdAt
*/ *
private $update_reason; * @param datetime $createdAt
* @return News
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/** /**
* @var string $title * Get createdAt
*/ *
private $title; * @return datetime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/** /**
* @var string $slug * @var datetime $updatedAt
*/ * @ORM\Column(type="datetime", name="updated_at", nullable=true)
private $slug; */
private $updatedAt;
/** /**
* @var text $text * @var text $updateReason
*/ * @ORM\Column(type="text", name="update_reason", nullable=true)
private $text; */
private $updateReason;
/** /**
* @var KekRozsak\FrontBundle\Entity\User * @var string $title
*/ * @ORM\Column(type="string", length=100, nullable=false)
private $created_by; */
private $title;
/** /**
* @var KekRozsak\FrontBundle\Entity\User * @var string $slug
*/ * @ORM\Column(type="string", length=100, nullable=false, unique=true)
private $updated_by; */
private $slug;
/**
* @var text $text
* @ORM\Column(type="text", nullable=true)
*/
private $text;
/** /**
* Get id * @var KekRozsak\FrontBundle\Entity\User $createdBy
* * @ORM\ManyToOne(targetEntity="User")
* @return integer * @ORM\JoinColumn(name="created_by_id", referencedColumnName="id")
*/ */
public function getId() private $createdBy;
{
return $this->id;
}
/** /**
* Set created_at * @var KekRozsak\FrontBundle\Entity\User $updatedBy
* * @ORM\ManyToOne(targetEntity="User", fetch="EXTRA_LAZY")
* @param datetime $createdAt * @ORM\JoinColumn(name="updated_by_id", referencedColumnName="id")
* @return News */
*/ private $updatedBy;
public function setCreatedAt($createdAt)
{
$this->created_at = $createdAt;
return $this;
}
/** /**
* Get created_at * Set updatedAt
* *
* @return datetime * @param datetime $updatedAt
*/ * @return News
public function getCreatedAt() */
{ public function setUpdatedAt($updatedAt)
return $this->created_at; {
} $this->updatedAt = $updatedAt;
return $this;
}
/** /**
* Set updated_at * Get updatedAt
* *
* @param datetime $updatedAt * @return datetime
* @return News */
*/ public function getUpdatedAt()
public function setUpdatedAt($updatedAt) {
{ return $this->updatedAt;
$this->updated_at = $updatedAt; }
return $this;
}
/** /**
* Get updated_at * Set updateReason
* *
* @return datetime * @param text $updateReason
*/ * @return News
public function getUpdatedAt() */
{ public function setUpdateReason($updateReason)
return $this->updated_at; {
} $this->updateReason = $updateReason;
return $this;
}
/** /**
* Set update_reason * Get updateReason
* *
* @param text $updateReason * @return text
* @return News */
*/ public function getUpdateReason()
public function setUpdateReason($updateReason) {
{ return $this->updateReason;
$this->update_reason = $updateReason; }
return $this;
}
/** /**
* Get update_reason * Set title
* *
* @return text * @param string $title
*/ * @return News
public function getUpdateReason() */
{ public function setTitle($title)
return $this->update_reason; {
} $this->title = $title;
return $this;
}
/** /**
* Set title * Get title
* *
* @param string $title * @return string
* @return News */
*/ public function getTitle()
public function setTitle($title) {
{ return $this->title;
$this->title = $title; }
return $this;
}
/** /**
* Get title * Set slug
* *
* @return string * @param string $slug
*/ * @return News
public function getTitle() */
{ public function setSlug($slug)
return $this->title; {
} $this->slug = $slug;
return $this;
}
/** /**
* Set slug * Get slug
* *
* @param string $slug * @return string
* @return News */
*/ public function getSlug()
public function setSlug($slug) {
{ return $this->slug;
$this->slug = $slug; }
return $this;
}
/** /**
* Get slug * Set text
* *
* @return string * @param text $text
*/ * @return News
public function getSlug() */
{ public function setText($text)
return $this->slug; {
} $this->text = $text;
return $this;
}
/** /**
* Set text * Get text
* *
* @param text $text * @return text
* @return News */
*/ public function getText()
public function setText($text) {
{ return $this->text;
$this->text = $text; }
return $this;
}
/** /**
* Get text * Set createdBy
* *
* @return text * @param KekRozsak\FrontBundle\Entity\User $createdBy
*/ * @return News
public function getText() */
{ public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy = null)
return $this->text; {
} $this->createdBy = $createdBy;
return $this;
}
/** /**
* Set created_by * Get createdBy
* *
* @param KekRozsak\FrontBundle\Entity\User $createdBy * @return KekRozsak\FrontBundle\Entity\User
* @return News */
*/ public function getCreatedBy()
public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy = null) {
{ return $this->createdBy;
$this->created_by = $createdBy; }
return $this;
}
/** /**
* Get created_by * Set updatedBy
* *
* @return KekRozsak\FrontBundle\Entity\User * @param KekRozsak\FrontBundle\Entity\User $updatedBy
*/ * @return News
public function getCreatedBy() */
{ public function setUpdatedBy(\KekRozsak\FrontBundle\Entity\User $updatedBy = null)
return $this->created_by; {
} $this->updatedBy = $updatedBy;
return $this;
}
/** /**
* Set updated_by * Get updatedBy
* *
* @param KekRozsak\FrontBundle\Entity\User $updatedBy * @return KekRozsak\FrontBundle\Entity\User
* @return News */
*/ public function getUpdatedBy()
public function setUpdatedBy(\KekRozsak\FrontBundle\Entity\User $updatedBy = null) {
{ return $this->updatedBy;
$this->updated_by = $updatedBy; }
return $this; }
}
/**
* Get updated_by
*
* @return KekRozsak\FrontBundle\Entity\User
*/
public function getUpdatedBy()
{
return $this->updated_by;
}
}

View File

@ -0,0 +1,292 @@
<?php
namespace KekRozsak\FrontBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use KekRozsak\FrontBundle\Entity\User;
/**
* KekRozsak\FrontBundle\Entity\Poll
* @ORM\Entity
* @ORM\Table(name="polls")
*/
class Poll
{
/**
* @var integer $id
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
private $id;
/**
* @var DateTime $createdAt
* @ORM\Column(type="datetime", nullable=false, name="created_at")
*/
private $createdAt;
/**
* @var DateTime $updatedAt
* @ORM\Column(type="datetime", name="updated_at")
*/
private $updatedAt;
/**
* @var text $updateReason
* @ORM\Column(type="text", name="update_reason")
*/
private $updateReason;
/**
* @var DateTime $pollEnd
* @ORM\Column(type="datetime", nullable=false, name="poll_end")
*/
private $pollEnd;
/**
* @var \Doctrine\Common\Collections\ArrayCollection
* @ORM\OneToMany(targetEntity="PollAnswer", mappedBy="answers")
*/
private $answers;
/**
* @var KekRozsak\FrontBundle\Entity\User
* @ORM\ManyToOne(targetEntity="User")
* @ORM\JoinColumn(name="created_by_id", referencedColumnName="id")
*/
private $createdBy;
/**
* @var KekRozsak\FrontBundle\Entity\User
* @ORM\ManyToOne(targetEntity="User")
* @ORM\JoinColumn(name="updated_by_id", referencedColumnName="id")
*/
private $updatedBy;
public function __construct()
{
$this->answers = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set createdAt
*
* @param datetime $createdAt
* @return Poll
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return datetime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set updatedAt
*
* @param datetime $updatedAt
* @return Poll
*/
public function setUpdatedAt($updatedAt = null)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt
*
* @return datetime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* Set updateReason
*
* @param text $updateReason
* @return Poll
*/
public function setUpdateReason($updateReason = null)
{
$this->updateReason = $updateReason;
return $this;
}
/**
* Get updateReason
*
* @return text
*/
public function getUpdateReason()
{
return $this->updateReason;
}
/**
* Set pollEnd
*
* @param datetime $pollEnd
* @return Poll
*/
public function setPollEnd($pollEnd = null)
{
$this->pollEnd = $pollEnd;
return $this;
}
/**
* Get pollEnd
*
* @return datetime
*/
public function getPollEnd()
{
return $this->pollEnd;
}
/**
* Add answers
*
* @param KekRozsak\FrontBundle\Entity\PollAnswer $answers
* @return Poll
*/
public function addPollAnswer(\KekRozsak\FrontBundle\Entity\PollAnswer $answers)
{
$this->answers[] = $answers;
return $this;
}
/**
* Get answers
*
* @return Doctrine\Common\Collections\Collection
*/
public function getAnswers()
{
return $this->answers;
}
/**
* Set createdBy
*
* @param KekRozsak\FrontBundle\Entity\User $createdBy
* @return Poll
*/
public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy)
{
$this->createdBy = $createdBy;
return $this;
}
/**
* Get createdBy
*
* @return KekRozsak\FrontBundle\Entity\User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* Set updatedBy
*
* @param KekRozsak\FrontBundle\Entity\User $updatedBy
* @return Poll
*/
public function setUpdatedBy(\KekRozsak\FrontBundle\Entity\User $updatedBy = null)
{
$this->updatedBy = $updatedBy;
return $this;
}
/**
* Get updatedBy
*
* @return KekRozsak\FrontBundle\Entity\User
*/
public function getUpdatedBy()
{
return $this->updatedBy;
}
/**
* @var text $text
* @ORM\Column(type="text", nullable=false)
*/
private $text;
/**
* @var boolean $anyoneCanAddAnswers
* @ORM\Column(type="boolean", nullable=false)
*/
private $anyoneCanAddAnswers;
/**
* Set text
*
* @param text $text
* @return Poll
*/
public function setText($text)
{
$this->text = $text;
return $this;
}
/**
* Get text
*
* @return text
*/
public function getText()
{
return $this->text;
}
/**
* Set anyoneCanAddAnswers
*
* @param boolean $anyoneCanAddAnswers
* @return Poll
*/
public function setAnyoneCanAddAnswers($anyoneCanAddAnswers)
{
$this->anyoneCanAddAnswers = $anyoneCanAddAnswers;
return $this;
}
/**
* Get anyoneCanAddAnswers
*
* @return boolean
*/
public function getAnyoneCanAddAnswers()
{
return $this->anyoneCanAddAnswers;
}
}

View File

@ -0,0 +1,265 @@
<?php
namespace KekRozsak\FrontBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use KekRozsak\FrontBundle\Entity\User;
use KekRozsak\FrontBundle\Entity\Poll;
/**
* KekRozsak\FrontBundle\Entity\PollAnswer
* @ORM\Entity
* @ORM\Table(name="poll_answers")
*/
class PollAnswer
{
/**
* @var integer $id
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
private $id;
/**
* @var DateTime $createdAt
* @ORM\Column(name="created_at", type="datetime")
*/
private $createdAt;
/**
* @var DateTime $updatedAt
* @ORM\Column(name="updated_at", type="datetime")
*/
private $updatedAt;
/**
* @var text $updateReason
* @ORM\Column(type="text", name="update_reason", nullable=true)
*/
private $updateReason;
/**
* @var \Doctrine\Common\Collections\ArrayCollection
* @ORM\ManyToMany(targetEntity="User", inversedBy="pollVotes")
*/
private $voters;
/**
* @var User
* @ORM\ManyToOne(targetEntity="User")
* @ORM\JoinColumn(name="created_by_id")
*/
private $createdBy;
/**
* @var User
* @ORM\ManyToOne(targetEntity="User")
* @ORM\JoinColumn(name="updated_by_id")
*/
private $updatedBy;
/**
* @var poll
* @ORM\ManyToOne(targetEntity="Poll", inversedBy="answers")
*/
private $poll;
public function __construct()
{
$this->voters = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set createdAt
*
* @param datetime $createdAt
* @return PollAnswer
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return datetime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set updatedAt
*
* @param datetime $updatedAt
* @return PollAnswer
*/
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt
*
* @return datetime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* Set updateReason
*
* @param text $updateReason
* @return PollAnswer
*/
public function setUpdateReason($updateReason)
{
$this->updateReason = $updateReason;
return $this;
}
/**
* Get updateReason
*
* @return text
*/
public function getUpdateReason()
{
return $this->updateReason;
}
/**
* Add voters
*
* @param User $voters
* @return PollAnswer
*/
public function addVoters(User $voters)
{
$this->voters[] = $voters;
return $this;
}
/**
* Get voters
*
* @return Doctrine\Common\Collections\Collection
*/
public function getVoters()
{
return $this->voters;
}
/**
* Set createdBy
*
* @param User $createdBy
* @return PollAnswer
*/
public function setCreatedBy(User $createdBy = null)
{
$this->createdBy = $createdBy;
return $this;
}
/**
* Get createdBy
*
* @return User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* Set updatedBy
*
* @param User $updatedBy
* @return PollAnswer
*/
public function setUpdatedBy(User $updatedBy = null)
{
$this->updatedBy = $updatedBy;
return $this;
}
/**
* Get updatedBy
*
* @return User
*/
public function getUpdatedBy()
{
return $this->updatedBy;
}
/**
* Set poll
*
* @param Poll $poll
* @return PollAnswer
*/
public function setPoll(Poll $poll = null)
{
$this->poll = $poll;
return $this;
}
/**
* Get poll
*
* @return Poll
*/
public function getPoll()
{
return $this->poll;
}
/**
* @var string $text
* @ORM\Column(type="text", nullable=false)
*/
private $text;
/**
* Set text
*
* @param string $text
* @return PollAnswer
*/
public function setText($text)
{
$this->text = $text;
return $this;
}
/**
* Get text
*
* @return string
*/
public function getText()
{
return $this->text;
}
}

View File

@ -1,145 +0,0 @@
<?php
namespace KekRozsak\FrontBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\Role\RoleInterface;
/**
* KekRozsak\FrontBundle\Entity\Role
*/
class Role implements RoleInterface
{
/**
* @var integer $id
*/
private $id;
/**
* @var string $name
*/
private $name;
/**
* @var string $display_name
*/
private $display_name;
/**
* @var boolean $can_be_assigned
*/
private $can_be_assigned;
/**
* @var \Doctrine\Common\Collections\ArrayCollection
*/
private $included_roles;
public function __construct()
{
$this->included_roles = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
* @return Role
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set display_name
*
* @param string $displayName
* @return Role
*/
public function setDisplayName($displayName)
{
$this->display_name = $displayName;
return $this;
}
/**
* Get display_name
*
* @return string
*/
public function getDisplayName()
{
return $this->display_name;
}
/**
* Set can_be_assigned
*
* @param boolean $canBeAssigned
* @return Role
*/
public function setCanBeAssigned($canBeAssigned)
{
$this->can_be_assigned = $canBeAssigned;
return $this;
}
/**
* Get can_be_assigned
*
* @return boolean
*/
public function getCanBeAssigned()
{
return $this->can_be_assigned;
}
/**
* Add included_roles
*
* @param KekRozsak\FrontBundle\Entity\Role $includedRoles
* @return Role
*/
public function addRole(\KekRozsak\FrontBundle\Entity\Role $includedRoles)
{
$this->included_roles[] = $includedRoles;
return $this;
}
/**
* Get included_roles
*
* @return Doctrine\Common\Collections\Collection
*/
public function getIncludedRoles()
{
return $this->included_roles;
}
public function getRole()
{
return $this->name;
}
}

View File

@ -5,360 +5,484 @@ namespace KekRozsak\FrontBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\AdvancedUserInterface; use Symfony\Component\Security\Core\User\AdvancedUserInterface;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints as DoctrineAssert;
use KekRozsak\FrontBundle\Entity\Article;
use KekRozsak\FrontBundle\Entity\ForumPost;
use KekRozsak\FrontBundle\Entity\Group;
use KekRozsak\FrontBundle\Entity\Document;
use KekRozsak\FrontBundle\Entity\UserData;
use KekRozsak\FrontBundle\Entity\PollAnswer;
/** /**
* KekRozsak\FrontBundle\Entity\User * KekRozsak\FrontBundle\Entity\User
* @ORM\Entity
* @ORM\Table(name="users")
* @DoctrineAssert\UniqueEntity(fields={"username"}, message="Ez a felhasználónév már foglalt. Kérlek, válassz egy másikat!", groups={"registration"})
* @DoctrineAssert\UniqueEntity(fields={"email"}, message="Ez az e-mail cím már foglalt. Kérlek, válassz egy másikat!", groups={"registration"})
* @DoctrineAssert\UniqueEntity(fields={"displayName"}, message="Ez a név már foglalt. Kérlek, válassz egy másikat!", groups={"registration"})
*/ */
class User implements UserInterface, AdvancedUserInterface class User implements UserInterface, AdvancedUserInterface
{ {
/** /**
* @var integer $id * @var integer $id
*/ * @ORM\Id
private $id; * @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
private $id;
/** /**
* @var string $username * Get id
*/ *
private $username; * @return integer
*/
public function getId()
{
return $this->id;
}
/** /**
* @var string $password * @var string $username
*/ * @ORM\Column(type="string", length=50, nullable=false, unique=true)
private $password; * @Assert\NotBlank(groups={"registration"})
*/
private $username;
/** /**
* @var string $email * Set username
*/ *
private $email; * @param string $username
* @return User
*/
public function setUsername($username)
{
$this->username = $username;
return $this;
}
/** /**
* @var DateTime $registered_at * Get username
*/ *
private $registered_at; * @return string
*/
public function getUsername()
{
return $this->username;
}
/** /**
* @var string $display_name * @var string $password
*/ * @ORM\Column(type="string", length=50, nullable=false)
private $display_name; * @Assert\NotBlank(groups={"registration"})
*/
private $password;
/** /**
* @var \Doctrine\Common\Collections\ArrayCollection * Set password
*/ *
private $roles; * @param string $password
* @return User
*/
public function setPassword($password)
{
$this->password = $password;
return $this;
}
public function __construct() /**
{ * Get password
$this->roles = new \Doctrine\Common\Collections\ArrayCollection(); *
} * @return string
*/
/** public function getPassword()
* Get id {
* return $this->password;
* @return integer }
*/
public function getId()
{
return $this->id;
}
/** /**
* Set username * @var string $email
* * @ORM\Column(type="string", length=50, unique=true, nullable=false)
* @param string $username * @Assert\NotBlank(groups={"registration"})
* @return User * @Assert\Email(groups={"registration"})
*/ */
public function setUsername($username) private $email;
{
$this->username = $username;
return $this;
}
/** /**
* Get username * Set email
* *
* @return string * @param string $email
*/ * @return User
public function getUsername() */
{ public function setEmail($email)
return $this->username; {
} $this->email = $email;
return $this;
}
/** /**
* Set password * Get email
* *
* @param string $password * @return string
* @return User */
*/ public function getEmail()
public function setPassword($password) {
{ return $this->email;
$this->password = $password; }
return $this;
}
/** /**
* Get password * @var DateTime $registeredAt
* * @ORM\Column(type="datetime", name="registered_at", nullable=false)
* @return string * @Assert\NotBlank()
*/ * TODO: original validation.yml contained Type: \DateTime
public function getPassword() * Assert\Type("\\DateTime")
{ */
return $this->password; private $registeredAt;
}
/** /**
* Set email * Set registeredAt
* *
* @param string $email * @param DateTime $registeredAt
* @return User * @return User
*/ */
public function setEmail($email) public function setRegisteredAt(\DateTime $registeredAt)
{ {
$this->email = $email; $this->registeredAt = $registeredAt;
return $this; return $this;
} }
/** /**
* Get email * Get registeredAt
* *
* @return string * @return DateTime
*/ */
public function getEmail() public function getRegisteredAt()
{ {
return $this->email; return $this->registeredAt;
} }
/** /**
* Set registered_at * @var string $displayName
* * @ORM\Column(type="string", length=50, nullable=false, unique=true, name="display_name")
* @param DateTime $registeredAt */
* @return User private $displayName;
*/
public function setRegisteredAt(\DateTime $registeredAt)
{
$this->registered_at = $registeredAt;
return $this;
}
/** /**
* Get registered_at * Set displayName
* *
* @return DateTime * @param string $displayName
*/ * @return User
public function getRegisteredAt() */
{ public function setDisplayName($displayName)
return $this->registered_at; {
} $this->displayName = $displayName;
return $this;
}
/** /**
* Set display_name * Get displayName
* *
* @param string $displayName * @return string
* @return User */
*/ public function getDisplayName()
public function setDisplayName($displayName) {
{ return $this->displayName;
$this->display_name = $displayName; }
return $this;
}
/** /**
* Get display_name * @var User $acceptedBy
* * @ORM\ManyToOne(targetEntity="User", fetch="EXTRA_LAZY")
* @return string * @ORM\JoinColumn(name="accepted_by_id", referencedColumnName="id")
*/ */
public function getDisplayName() private $acceptedBy;
{
return $this->display_name;
}
/** /**
* Add roles * Set acceptedBy
* *
* @param KekRozsak\FrontBundle\Entity\Role $roles * @param User $acceptedBy
* @return User * @return User
*/ */
public function addRole(\KekRozsak\FrontBundle\Entity\Role $roles) public function setAcceptedBy(User $acceptedBy = null)
{ {
$this->roles[] = $roles; $this->acceptedBy = $acceptedBy;
return $this; return $this;
} }
/** /**
* Get roles * Get acceptedBy
* *
* @return Doctrine\Common\Collections\Collection * @return User
*/ */
public function getRoles() public function getAcceptedBy()
{ {
return $this->roles->toArray(); return $this->acceptedBy;
} }
public function getRolesCollection() /**
{ * @var datetime $lastLoginAt
return $this->roles; * @ORM\Column(type="datetime", nullable=true, name="last_login_at")
} */
private $lastLoginAt;
public function eraseCredentials() /**
{ * Set lastLoginAt
} *
* @param DateTime $lastLoginAt
* @return User
*/
public function setLastLoginAt(\DateTime $lastLoginAt = null)
{
$this->lastLoginAt = $lastLoginAt;
return $this;
}
public function getSalt() /**
{ * Get lastLoginAt
return $this->password; *
} * @return DateTime
/** */
* @var \Doctrine\Common\Collections\ArrayCollection public function getLastLoginAt()
*/ {
private $articles; return $this->lastLoginAt;
}
/** /**
* @var \Doctrine\Common\Collections\ArrayCollection * @var \Doctrine\Common\Collections\ArrayCollection
*/ * @ORM\OneToMany(targetEntity="Article", mappedBy="createdBy", fetch="EXTRA_LAZY")
private $forum_posts; */
private $articles;
/**
* Add articles
*
* @param Article $articles
* @return User
*/
public function addArticle(Article $articles)
{
$this->articles[] = $articles;
return $this;
}
/** /**
* Add articles * Get articles
* *
* @param KekRozsak\FrontBundle\Entity\Article $articles * @return Doctrine\Common\Collections\Collection
* @return User */
*/ public function getArticles()
public function addArticle(\KekRozsak\FrontBundle\Entity\Article $articles) {
{ return $this->articles;
$this->articles[] = $articles; }
return $this;
}
/** /**
* Get articles * @var \Doctrine\Common\Collections\ArrayCollection
* * @ORM\OneToMany(targetEntity="ForumPost", mappedBy="createdBy", fetch="EXTRA_LAZY")
* @return Doctrine\Common\Collections\Collection */
*/ private $forumPosts;
public function getArticles()
{
return $this->articles;
}
/** /**
* Add forum_posts * Add forumPosts
* *
* @param KekRozsak\FrontBundle\Entity\ForumPost $forumPosts * @param ForumPost $forumPosts
* @return User * @return User
*/ */
public function addForumPost(\KekRozsak\FrontBundle\Entity\ForumPost $forumPosts) public function addForumPost(ForumPost $forumPosts)
{ {
$this->forum_posts[] = $forumPosts; $this->forumPosts[] = $forumPosts;
return $this; return $this;
} }
/** /**
* Get forum_posts * Get forumPosts
* *
* @return Doctrine\Common\Collections\Collection * @return Doctrine\Common\Collections\Collection
*/ */
public function getForumPosts() public function getForumPosts()
{ {
return $this->forum_posts; return $this->forumPosts;
} }
/**
* @var KekRozsak\FrontBundle\Entity\User
*/
private $accepted_by;
/**
* @var \Doctrine\Common\Collections\ArrayCollection $ledGroups
* @ORM\OneToMany(targetEntity="Group", mappedBy="leader", fetch="EXTRA_LAZY")
*/
private $ledGroups;
/** /**
* Set accepted_by * Add ledGroups
* *
* @param KekRozsak\FrontBundle\Entity\User $acceptedBy * @param Group $group
* @return User * @return User
*/ */
public function setAcceptedBy(\KekRozsak\FrontBundle\Entity\User $acceptedBy = null) public function addGroup(Group $group)
{ {
$this->accepted_by = $acceptedBy; $this->ledGroups[] = $group;
return $this; return $this;
} }
/** /**
* Get accepted_by * Get ledGroups
* *
* @return KekRozsak\FrontBundle\Entity\User * @return Doctrine\Common\Collections\Collection
*/ */
public function getAcceptedBy() public function getLedGroups()
{ {
return $this->accepted_by; return $this->ledGroups;
} }
public function isAccountNonExpired() /**
{ * @var \Doctrine\Common\Collections\ArrayCollection $createdDocuments
return true; * @ORM\OneToMany(targetEntity="Document", mappedBy="createdBy", fetch="EXTRA_LAZY")
} */
private $createdDocuments;
public function isAccountNonLocked()
{
return true;
}
public function isCredentialsNonExpired()
{
return true;
}
public function isEnabled()
{
return ($this->accepted_by !== null);
}
/**
* @var datetime $last_login_at
*/
private $last_login_at;
/**
* Add createdDocuments
*
* @param Document $document
* @return User
*/
public function addDocument(Document $document)
{
$this->createdDocuments[] = $document;
return $this;
}
/** /**
* Set last_login_at * Get createdDocuments
* *
* @param datetime $lastLoginAt * @return Doctrine\Common\Collections\Collection
* @return User */
*/ public function getCreatedDocuments()
public function setLastLoginAt($lastLoginAt) {
{ return $this->createdDocuments;
$this->last_login_at = $lastLoginAt; }
return $this;
}
/** /**
* Get last_login_at * @var UserData $userData
* * @ORM\OneToOne(targetEntity="UserData", mappedBy="user", fetch="EXTRA_LAZY", cascade={"persist"})
* @return datetime * @ORM\JoinColumn(name="id", referencedColumnName="user_id")
*/ */
public function getLastLoginAt() private $userData;
{
return $this->last_login_at;
}
/**
* @var KekRozsak\FrontBundle\Entity\UserData
*/
private $user_data;
/**
* Set userData
*
* @param UserData $userData
* @return User
*/
public function setUserData(UserData $userData = null)
{
$this->userData = $userData;
return $this;
}
/** /**
* Set user_data * Get userData
* *
* @param KekRozsak\FrontBundle\Entity\UserData $userData * @return UserData
* @return User */
*/ public function getUserData()
public function setUserData(\KekRozsak\FrontBundle\Entity\UserData $userData = null) {
{ return $this->userData;
$this->user_data = $userData; }
return $this;
}
/** /**
* Get user_data * @var PollAnswer
* * @ORM\ManyToMany(targetEntity="PollAnswer", mappedBy="voters", fetch="EXTRA_LAZY")
* @return KekRozsak\FrontBundle\Entity\UserData */
*/ private $pollVotes;
public function getUserData()
{ /**
return $this->user_data; * Set pollVotes
} *
} * @param PollAnswer $pollVotes
* @return User
*/
public function setPollVotes(PollAnswer $pollVotes = null)
{
$this->pollVotes = $pollVotes;
return $this;
}
/**
* Get pollVotes
*
* @return PollAnswer
*/
public function getPollVotes()
{
return $this->pollVotes;
}
/**
* Add pollVotes
*
* @param PollAnswer $pollVotes
* @return User
*/
public function addPollAnswer(PollAnswer $pollVotes)
{
$this->pollVotes[] = $pollVotes;
return $this;
}
/**
* UserInterface::eraseCredentials()
*/
public function eraseCredentials()
{
}
/**
* UserInterface::getSalt()
*
* As we use crypt() to encrypt and check password, salt is always the
* same as the encrypted password.
*/
public function getSalt()
{
return $this->password;
}
/**
* UserInterface::getRoles
*/
public function getRoles()
{
return array('ROLE_USER');
}
/**
* AdvancedUserInterface::isAccountNonExpired()
*/
public function isAccountNonExpired()
{
return true;
}
/**
* AdvancedUserInterface::isAccountNonLocked()
*/
public function isAccountNonLocked()
{
return true;
}
/**
* AdvancedUserInterface::isCredentialsNonExpired()
*/
public function isCredentialsNonExpired()
{
return true;
}
/**
* AdvancedUserInterface::isEnabled()
*/
public function isEnabled()
{
return ($this->acceptedBy !== null);
}
}

View File

@ -4,388 +4,379 @@ namespace KekRozsak\FrontBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use KekRozsak\FrontBundle\Entity\User;
/** /**
* KekRozsak\FrontBundle\Entity\UserData * KekRozsak\FrontBundle\Entity\UserData
* @ORM\Entity
* @ORM\Table(name="user_data")
*/ */
class UserData class UserData
{ {
/** /**
* @var KekRozsak\FrontBundle\Entity\User * @var User $user
*/ * @ORM\Id
private $user; * @ORM\OneToOne(targetEntity="User", inversedBy="userData")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/
protected $user;
/**
* Set user
*
* @param User $user
* @return UserData
*/
public function setUser(User $user = null)
{
$this->user = $user;
$this->userId = $user->getId();
return $this;
}
/** /**
* Set user * Get user
* *
* @param KekRozsak\FrontBundle\Entity\User $user * @return User
* @return UserData */
*/ public function getUser()
public function setUser(\KekRozsak\FrontBundle\Entity\User $user = null) {
{ return $this->user;
$this->user = $user; }
$this->user_id = $user->getId();
return $this;
}
/** /**
* Get user * @var boolean $emailPublic
* * @ORM\Column(type="boolean", name="email_public")
* @return KekRozsak\FrontBundle\Entity\User */
*/ protected $emailPublic;
public function getUser()
{
return $this->user;
}
/**
* @var integer $user_id
*/
private $user_id;
/** /**
* @var string $realName * Set emailPublic
*/ *
private $realName; * @param boolean $emailPublic
* @return UserData
*/
public function setEmailPublic($emailPublic)
{
$this->emailPublic = $emailPublic;
return $this;
}
/** /**
* @var boolean $realNamePublic * Get emailPublic
*/ *
private $realNamePublic; * @return boolean
*/
public function getEmailPublic()
{
return $this->emailPublic;
}
/**
* @var string $realName
* @ORM\Column(name="real_name", type="string", length=100, nullable=true)
*/
protected $realName;
/** /**
* Set user_id * Set realName
* *
* @param integer $userId * @param string $realName
* @return UserData * @return UserData
*/ */
public function setUserId($userId) public function setRealName($realName)
{ {
$this->user_id = $userId; $this->realName = $realName;
return $this; return $this;
} }
/** /**
* Get user_id * Get realName
* *
* @return integer * @return string
*/ */
public function getUserId() public function getRealName()
{ {
return $this->user_id; return $this->realName;
} }
/** /**
* Set realName * @var boolean $realNamePublic
* * @ORM\Column(name="real_name_public", type="boolean", nullable=false)
* @param string $realName */
* @return UserData protected $realNamePublic;
*/
public function setRealName($realName)
{
$this->realName = $realName;
return $this;
}
/** /**
* Get realName * Set realNamePublic
* *
* @return string * @param boolean $realNamePublic
*/ * @return UserData
public function getRealName() */
{ public function setRealNamePublic($realNamePublic)
return $this->realName; {
} $this->realNamePublic = $realNamePublic;
return $this;
}
/** /**
* Set realNamePublic * Get realNamePublic
* *
* @param boolean $realNamePublic * @return boolean
* @return UserData */
*/ public function getRealNamePublic()
public function setRealNamePublic($realNamePublic) {
{ return $this->realNamePublic;
$this->realNamePublic = $realNamePublic; }
return $this;
}
/** /**
* Get realNamePublic * @var text $selfDescription
* * @ORM\Column(name="self_description", type="text", nullable=true)
* @return boolean */
*/ protected $selfDescription;
public function getRealNamePublic()
{
return $this->realNamePublic;
}
/**
* @var text $selfDescription
*/
private $selfDescription;
/** /**
* @var boolean $emailPublic * Set selfDescription
*/ *
private $emailPublic; * @param text $selfDescription
* @return UserData
*/
public function setSelfDescription($selfDescription)
{
$this->selfDescription = $selfDescription;
return $this;
}
/**
* Get selfDescription
*
* @return text
*/
public function getSelfDescription()
{
return $this->selfDescription;
}
/** /**
* Set selfDescription * @var string $msnAddress
* * @ORM\Column(type="string", length=100, name="msn_address", nullable=true)
* @param text $selfDescription */
* @return UserData protected $msnAddress;
*/
public function setSelfDescription($selfDescription)
{
$this->selfDescription = $selfDescription;
return $this;
}
/** /**
* Get selfDescription * Set msnAddress
* *
* @return text * @param string $msnAddress
*/ * @return UserData
public function getSelfDescription() */
{ public function setMsnAddress($msnAddress)
return $this->selfDescription; {
} $this->msnAddress = $msnAddress;
return $this;
}
/** /**
* Set emailPublic * Get msnAddress
* *
* @param boolean $emailPublic * @return string
* @return UserData */
*/ public function getMsnAddress()
public function setEmailPublic($emailPublic) {
{ return $this->msnAddress;
$this->emailPublic = $emailPublic; }
return $this;
}
/** /**
* Get emailPublic * @var boolean $msnAddressPublic
* * @ORM\Column(type="boolean", name="msn_address_public", nullable=false)
* @return boolean */
*/ protected $msnAddressPublic;
public function getEmailPublic()
{
return $this->emailPublic;
}
/**
* @var string $msnAddress
*/
private $msnAddress;
/** /**
* @var boolean $msnAddressPublic * Set msnAddressPublic
*/ *
private $msnAddressPublic; * @param boolean $msnAddressPublic
* @return UserData
*/
public function setMsnAddressPublic($msnAddressPublic)
{
$this->msnAddressPublic = $msnAddressPublic;
return $this;
}
/** /**
* @var string $googleTalk * Get msnAddressPublic
*/ *
private $googleTalk; * @return boolean
*/
public function getMsnAddressPublic()
{
return $this->msnAddressPublic;
}
/** /**
* @var boolean $googleTalkPublic * @var string $googleTalk
*/ * @ORM\Column(type="string", length=100, name="google_talk", nullable=true)
private $googleTalkPublic; */
protected $googleTalk;
/** /**
* @var string $skype * Set googleTalk
*/ *
private $skype; * @param string $googleTalk
* @return UserData
*/
public function setGoogleTalk($googleTalk)
{
$this->googleTalk = $googleTalk;
return $this;
}
/** /**
* @var boolean $skypePublic * Get googleTalk
*/ *
private $skypePublic; * @return string
*/
public function getGoogleTalk()
{
return $this->googleTalk;
}
/**
* @var boolean $googleTalkPublic
* @ORM\Column(type="boolean", name="google_talk_public", nullable=false)
*/
protected $googleTalkPublic;
/** /**
* Set msnAddress * Set googleTalkPublic
* *
* @param string $msnAddress * @param boolean $googleTalkPublic
* @return UserData * @return UserData
*/ */
public function setMsnAddress($msnAddress) public function setGoogleTalkPublic($googleTalkPublic)
{ {
$this->msnAddress = $msnAddress; $this->googleTalkPublic = $googleTalkPublic;
return $this; return $this;
} }
/** /**
* Get msnAddress * Get googleTalkPublic
* *
* @return string * @return boolean
*/ */
public function getMsnAddress() public function getGoogleTalkPublic()
{ {
return $this->msnAddress; return $this->googleTalkPublic;
} }
/** /**
* Set msnAddressPublic * @var string $skype
* * @ORM\Column(type="string", length=100, nullable=true)
* @param boolean $msnAddressPublic */
* @return UserData protected $skype;
*/
public function setMsnAddressPublic($msnAddressPublic)
{
$this->msnAddressPublic = $msnAddressPublic;
return $this;
}
/** /**
* Get msnAddressPublic * Set skype
* *
* @return boolean * @param string $skype
*/ * @return UserData
public function getMsnAddressPublic() */
{ public function setSkype($skype)
return $this->msnAddressPublic; {
} $this->skype = $skype;
return $this;
}
/** /**
* Set googleTalk * Get skype
* *
* @param string $googleTalk * @return string
* @return UserData */
*/ public function getSkype()
public function setGoogleTalk($googleTalk) {
{ return $this->skype;
$this->googleTalk = $googleTalk; }
return $this;
}
/** /**
* Get googleTalk * @var boolean $skypePublic
* * @ORM\Column(type="boolean", name="skype_public", nullable=false)
* @return string */
*/ protected $skypePublic;
public function getGoogleTalk()
{
return $this->googleTalk;
}
/** /**
* Set googleTalkPublic * Set skypePublic
* *
* @param boolean $googleTalkPublic * @param boolean $skypePublic
* @return UserData * @return UserData
*/ */
public function setGoogleTalkPublic($googleTalkPublic) public function setSkypePublic($skypePublic)
{ {
$this->googleTalkPublic = $googleTalkPublic; $this->skypePublic = $skypePublic;
return $this; return $this;
} }
/** /**
* Get googleTalkPublic * Get skypePublic
* *
* @return boolean * @return boolean
*/ */
public function getGoogleTalkPublic() public function getSkypePublic()
{ {
return $this->googleTalkPublic; return $this->skypePublic;
} }
/** /**
* Set skype * @var string $phoneNumber
* * @ORM\Column(type="string", length=30, name="phone_number", nullable=true)
* @param string $skype */
* @return UserData protected $phoneNumber;
*/
public function setSkype($skype)
{
$this->skype = $skype;
return $this;
}
/** /**
* Get skype * Set phoneNumber
* *
* @return string * @param string $phoneNumber
*/ * @return UserData
public function getSkype() */
{ public function setPhoneNumber($phoneNumber = null)
return $this->skype; {
} $this->phoneNumber = $phoneNumber;
return $this;
}
/** /**
* Set skypePublic * Get phoneNumber
* *
* @param boolean $skypePublic * @return string
* @return UserData */
*/ public function getPhoneNumber()
public function setSkypePublic($skypePublic) {
{ return $this->phoneNumber;
$this->skypePublic = $skypePublic; }
return $this;
}
/** /**
* Get skypePublic * @var boolean $phoneNumberPublic
* * @ORM\Column(type="boolean", name="phone_number_public", nullable=false)
* @return boolean */
*/ protected $phoneNumberPublic;
public function getSkypePublic()
{
return $this->skypePublic;
}
/**
* @var string $phoneNumber
*/
private $phoneNumber;
/** /**
* @var boolean $phoneNumberPublic * Set phoneNumberPublic
*/ *
private $phoneNumberPublic; * @param boolean $phoneNumberPublic
* @return UserData
*/
public function setPhoneNumberPublic($phoneNumberPublic)
{
$this->phoneNumberPublic = $phoneNumberPublic;
return $this;
}
/**
/** * Get phoneNumberPublic
* Set phoneNumber *
* * @return boolean
* @param string $phoneNumber */
* @return UserData public function getPhoneNumberPublic()
*/ {
public function setPhoneNumber($phoneNumber) return $this->phoneNumberPublic;
{ }
$this->phoneNumber = $phoneNumber;
return $this;
}
/**
* Get phoneNumber
*
* @return string
*/
public function getPhoneNumber()
{
return $this->phoneNumber;
}
/**
* Set phoneNumberPublic
*
* @param boolean $phoneNumberPublic
* @return UserData
*/
public function setPhoneNumberPublic($phoneNumberPublic)
{
$this->phoneNumberPublic = $phoneNumberPublic;
return $this;
}
/**
* Get phoneNumberPublic
*
* @return boolean
*/
public function getPhoneNumberPublic()
{
return $this->phoneNumberPublic;
}
} }

View File

@ -17,7 +17,7 @@ class ForumPostType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder->add('created_at', 'hidden', array( $builder->add('createdAt', 'hidden', array(
'label' => 'Időpont', 'label' => 'Időpont',
'data' => new \DateTime('now') 'data' => new \DateTime('now')
)); ));

View File

@ -42,7 +42,7 @@ class UserType extends AbstractType
)); ));
if (!$this->_registration) if (!$this->_registration)
{ {
$builder->add('user_data', new UserDataType(), array( $builder->add('userData', new UserDataType(), array(
'label' => 'Egyéb adatok', 'label' => 'Egyéb adatok',
)); ));
} }

View File

@ -1,44 +0,0 @@
KekRozsak\FrontBundle\Entity\Article:
type: entity
table: articles
id:
id:
type: integer
generator:
strategy: AUTO
fields:
title:
type: string(100)
nullable: false
slug:
type: string(100)
nullable: false
unique: true
text:
type: text
nullable: false
source:
type: string(255)
nullable: true
created_at:
type: datetime
nullable: false
updated_at:
type: datetime
nullable: true
update_reason:
type: text
nullable: true
main_page:
type: boolean
nullable: true
default: false
manyToOne:
created_by:
targetEntity: User
inversedBy: articles
nullable: false
updated_by:
targetEntity: User
nullable: true
default: null

View File

@ -1,33 +0,0 @@
KekRozsak\FrontBundle\Entity\ForumPost:
type: entity
table: forum_posts
id:
id:
type: integer
generator:
strategy: AUTO
fields:
created_at:
type: datetime
nullable: false
updated_at:
type: datetime
nullable: true
update_reason:
type: string
nullable: true
text:
type: text
nullable: false
manyToOne:
created_by:
targetEntity: User
inversedBy: forum_posts
nullable: false
updated_by:
targetEntity: User
nullable: true
default: null
topic:
targetEntity: ForumTopic
inversedBy: posts

View File

@ -1,50 +0,0 @@
KekRozsak\FrontBundle\Entity\ForumTopic:
type: entity
table: forum_topics
id:
id:
type: integer
generator:
strategy: AUTO
fields:
title:
type: string(100)
nullable: false
slug:
type: string(100)
nullable: false
created_at:
type: datetime
nullable: false
updated_at:
type: datetime
nullable: true
update_reason:
type: text
nullable: true
oneToMany:
posts:
targetEntity: ForumPost
mappedBy: topic
manyToOne:
created_by:
targetEntity: User
inversedBy: articles
nullable: false
updated_by:
targetEntity: User
nullable: true
default: null
topic_group:
targetEntity: ForumTopicGroup
inversedBy: topics
nullable: false
oneToOne:
last_post:
targetEntity: ForumPost
nullable: true
default: null
cascade: [ persist ]
uniqueConstraint:
uniqueSlugByGroup:
columns: [ topic_group, slug ]

View File

@ -1,44 +0,0 @@
KekRozsak\FrontBundle\Entity\ForumTopicGroup:
type: entity
table: forum_topic_groups
id:
id:
type: integer
generator:
strategy: AUTO
fields:
title:
type: string(100)
nullable: false
slug:
type: string(100)
nullable: false
unique: true
created_at:
type: datetime
nullable: false
updated_at:
type: datetime
nullable: true
update_reason:
type: text
nullable: true
manyToOne:
created_by:
targetEntity: User
inversedBy: articles
nullable: false
updated_by:
targetEntity: User
nullable: true
default: null
oneToOne:
last_post:
targetEntity: ForumPost
nullable: true
default: null
cascade: [ persist ]
oneToMany:
topics:
targetEntity: ForumTopic
mappedBy: topic_group

View File

@ -1,39 +0,0 @@
KekRozsak\FrontBundle\Entity\News:
type: entity
table: news
id:
id:
type: integer
generator:
strategy: AUTO
fields:
created_at:
type: datetime
nullable: false
updated_at:
type: datetime
nullable: true
default: null
update_reason:
type: text
nullable: true
default: null
title:
type: string(100)
nullable: false
slug:
type: string(100)
nullable: false
unique: true
text:
type: text
nullable: false
manyToOne:
created_by:
targetEntity: User
nullable: false
inversedBy: news
updated_by:
targetEntity: User
nullable: true
default: null

View File

@ -1,30 +0,0 @@
KekRozsak\FrontBundle\Entity\Role:
type: entity
table: roles
id:
id:
type: integer
generator:
strategy: AUTO
fields:
name:
type: string(100)
nullable: false
display_name:
type: string(100)
nullable: false
can_be_assigned:
type: boolean
default: false
manyToMany:
included_roles:
targetEntity: Role
joinTable:
name: role_hierarchy
joinColumns:
parent_role_id:
referencedColumnName: id
inverseJoinColumns:
child_role_id:
referencedColumnName: id

View File

@ -1,51 +0,0 @@
KekRozsak\FrontBundle\Entity\User:
type: entity
table: users
id:
id:
type: integer
generator:
strategy: AUTO
fields:
username:
type: string(50)
nullable: false
password:
type: string(50)
nullable: false
email:
type: string(50)
nullable: false
registered_at:
type: datetime
display_name:
type: string(50)
nullable: false
last_login_at:
type: datetime
nullable: true
default: null
oneToMany:
articles:
targetEntity: Article
mappedBy: created_by
fetch: EXTRA_LAZY
forum_posts:
targetEntity: ForumPost
mappedBy: created_by
fetch: EXTRA_LAZY
manyToOne:
accepted_by:
targetEntity: User
fetch: EXTRA_LAZY
manyToMany:
roles:
targetEntity: Role
oneToOne:
user_data:
targetEntity: UserData
mappedBy: user
joinColumns:
id:
referencedColumnName: user_id
cascade: [ 'persist' ]

View File

@ -1,71 +0,0 @@
KekRozsak\FrontBundle\Entity\UserData:
type: entity
table: user_data
id:
user_id:
type: integer
fields:
emailPublic:
type: boolean
nullable: false
default: false
realName:
name: real_name
type: string(100)
nullable: true
default: null
realNamePublic:
name: real_name_public
type: boolean
nullable: true
default: false
selfDescription:
name: self_description_public
type: text
nullable: true
default: null
msnAddress:
name: msn
type: string(100)
nullable: true
default: null
msnAddressPublic:
name: msn_public
type: boolean
nullable: false
default: false
googleTalk:
name: google_talk
type: string(100)
nullable: true
default: null
googleTalkPublic:
name: goole_talk_public
type: boolean
nullable: false
default: false
skype:
type: string(100)
nullable: true
default: null
skypePublic:
name: skype_public
type: boolean
nullable: false
default: false
phoneNumber:
name: phone_number
type: string(30)
nullable: true
phoneNumberPublic:
name: phone_number_public
type: boolean
nullable: false
default: false
oneToOne:
user:
targetEntity: User
inversedBy: user_data
joinColumns:
user_id:
referencedColumnName: id

View File

@ -1,38 +0,0 @@
KekRozsakFrontBundle_homepage:
pattern: /
defaults:
_controller: KekRozsakFrontBundle:Default:homepage
KekRozsakFrontBundle_article:
pattern: /cikk/{articleSlug}
defaults:
_controller: KekRozsakFrontBundle:Default:article
KekRozsakFrontBundle_forum_main:
pattern: /forum
defaults:
_controller: KekRozsakFrontBundle:Forum:main
KekRozsakFrontBundle_forum_topic_list:
pattern: /forum/{topicGroupSlug}
defaults:
_controller: KekRozsakFrontBundle:Forum:topicList
KekRozsakFrontBundle_forum_post_list:
pattern: /forum/{topicGroupSlug}/{topicSlug}
defaults:
_controller: KekRozsakFrontBundle:Forum:postList
requirements:
_method: GET
KekRozsakFrontBundle_forum_new_post:
pattern: /forum/{topicGroupSlug}/{topicSlug}/post
defaults:
_controller: KekRozsakFrontBundle:Forum:postList
requirements:
_method: POST
KekRozsakFrontBundle_profile_edit:
pattern: /profil
defaults:
_controller: KekRozsakFrontBundle:Default:profileEdit

View File

@ -0,0 +1,17 @@
<?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">
<services>
<service id="kek_rozsak_front.twig_extension.news" class="KekRozsak\FrontBundle\Twig\NewsExtension">
<argument type="service" id="doctrine" />
<tag name="twig.extension" />
</service>
<service id="form.type_extension.help_message" class="KekRozsak\FrontBundle\Form\Extension\HelpMessageTypeExtension">
<tag name="form.type_extension" alias="field" />
</service>
<service id="bb.twig.extension" class="KekRozsak\FrontBundle\Extension\TwigBBExtension">
<argument type="service" id="service_container" />
<tag name="twig.extension" />
</service>
</services>
</container>

View File

@ -1,23 +0,0 @@
parameters:
# kek_rozsak_front.example.class: KekRozsak\FrontBundle\Example
services:
# kek_rozsak_front.example:
# class: %kek_rozsak_front.example.class%
# arguments: [@service_id, "plain_value", %parameter%]
kek_rozsak_front.twig_extension.news:
class: KekRozsak\FrontBundle\Twig\NewsExtension
arguments:
doctrine: @doctrine
tags:
- { name: twig.extension }
form.type_extension.help_message:
class: KekRozsak\FrontBundle\Form\Extension\HelpMessageTypeExtension
tags:
- { name: "form.type_extension", alias: "field" }
bb.twig.extension:
class: KekRozsak\FrontBundle\Extension\TwigBBExtension
arguments:
- @service_container
tags:
- { name: "twig.extension" }

View File

@ -1,29 +0,0 @@
KekRozsak\FrontBundle\Entity\User:
constraints:
- Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity:
fields: username
message: "Ez a felhasználónév már foglalt. Kérlek, válassz egy másikat!"
groups: [ registration ]
- Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity:
fields: email
message: "Ez az e-mail cím már foglalt. Kérlek, válassz egy másikat!"
groups: [ registration ]
- Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity:
fields: display_name
message: "Ez a név már foglalt. Kérlek, válassz egy másikat!"
groups: [ registration ]
properties:
username:
- NotBlank: { groups: [ registration ] }
password:
- NotBlank: { groups: [ registration ] }
email:
- NotBlank: { groups: [ registration ] }
- Email: { groups: [ registration ] }
registered_at:
- NotBlank: ~
- Type: \DateTime
display_name:
- NotBlank: { groups: [ registration ] }
KekRozsak\FrontBundle\Form\Type\UserType:

View File

@ -6,7 +6,7 @@
<tbody> <tbody>
<tr> <tr>
<td class="uj-post"> <td class="uj-post">
<form method="post" action="{{ path('KekRozsakFrontBundle_forum_new_post', { topicGroupSlug: topicGroup.slug, topicSlug: topic.slug } ) }}"> <form method="post" action="{{ path('KekRozsakFrontBundle_forum_post_list', { topicGroupSlug: topicGroup.slug, topicSlug: topic.slug } ) }}">
{{ form_widget(form) }} {{ form_widget(form) }}
<p> <p>
<span class="eszkoztar">Súgó</span><span class="kuldes-gomb" /><button type="submit">Küldés</button> <span class="eszkoztar">Súgó</span><span class="kuldes-gomb" /><button type="submit">Küldés</button>

View File

@ -16,7 +16,7 @@ class NewsExtension extends \Twig_Extension
public function getGlobals() public function getGlobals()
{ {
$newsRepo = $this->doctrine->getRepository('KekRozsakFrontBundle:News'); $newsRepo = $this->doctrine->getRepository('KekRozsakFrontBundle:News');
$news = $newsRepo->findBy(array(), array('created_at' => 'DESC'), 4); $news = $newsRepo->findBy(array(), array('createdAt' => 'DESC'), 4);
return array( return array(
'recentNews' => $news, 'recentNews' => $news,

View File

@ -6,12 +6,16 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Security\Core\SecurityContext; use Symfony\Component\Security\Core\SecurityContext;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use KekRozsak\FrontBundle\Entity\User; use KekRozsak\FrontBundle\Entity\User;
use KekRozsak\FrontBundle\Form\Type\UserType; use KekRozsak\FrontBundle\Form\Type\UserType;
class DefaultController extends Controller class DefaultController extends Controller
{ {
/**
* @Route("/login", name="KekRozsakSecurityBundle_login")
*/
public function loginAction() public function loginAction()
{ {
$request = $this->getRequest(); $request = $this->getRequest();
@ -33,6 +37,25 @@ class DefaultController extends Controller
)); ));
} }
/**
* @Route("/login_check", name="KekRozsakSecurityBundle_login_check")
*/
public function loginCheckAction()
{
// The security layer will intercept this request. This method will never be called.
}
/**
* @Route("/logout", name="KekRozsakSecurityBundle_logout")
*/
public function logoutAction()
{
// The security layer will intercept this request. This method will never be called.
}
/**
* @Route("/jelentkezes", name="KekRozsakSecurityBundle_registration")
*/
public function registrationAction(Request $request) public function registrationAction(Request $request)
{ {
$user = $this->get('security.context')->getToken()->getUser(); $user = $this->get('security.context')->getToken()->getUser();
@ -73,6 +96,9 @@ class DefaultController extends Controller
)); ));
} }
/**
* @Route("/most-varj", name="KekRozsakSecurityBundle_reg_success")
*/
public function registrationSuccessAction() public function registrationSuccessAction()
{ {
return $this->render('KekRozsakSecurityBundle:Default:registration_success.html.twig', array()); return $this->render('KekRozsakSecurityBundle:Default:registration_success.html.twig', array());

View File

@ -1,20 +0,0 @@
KekRozsakSecurityBundle_login:
pattern: /login
defaults:
_controller: KekRozsakSecurityBundle:Default:login
KekRozsakSecurityBundle_login_check:
pattern: /login_check
KekRozsakSecurityBundle_logout:
pattern: /logout
KekRozsakSecurityBundle_registration:
pattern: /jelentkezes
defaults:
_controller: KekRozsakSecurityBundle:Default:registration
KekRozsakSecurityBundle_reg_success:
pattern: /most-varj
defaults:
_controller: KekRozsakSecurityBundle:Default:registrationSuccess

View File

@ -1,4 +1,5 @@
{# vim: ft=htmljinja: #} {# vim: ft=htmljinja:
#}
{% extends '::main_template.html.twig' %} {% extends '::main_template.html.twig' %}
{% form_theme form 'KekRozsakFrontBundle:Form:user_form.html.twig' %} {% form_theme form 'KekRozsakFrontBundle:Form:user_form.html.twig' %}
{% block title %} - Regisztráció {% endblock %} {% block title %} - Regisztráció {% endblock %}