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")
*/
public function manageRegsAction()
{ {
return $this->render('KekRozsakAdminBundle:Default:manage_regs.html.twig'); $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,62 +4,23 @@ 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
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer", name="id")
*/ */
private $id; private $id;
/**
* @var string $title
*/
private $title;
/**
* @var string $slug
*/
private $slug;
/**
* @var text $text
*/
private $text;
/**
* @var string $source
*/
private $source;
/**
* @var DateTime $created_at
*/
private $created_at;
/**
* @var DateTime $updated_at
*/
private $updated_at;
/**
* @var text $update_reason
*/
private $update_reason;
/**
* @var KekRozsak\FrontBundle\Entity\User
*/
private $created_by;
/**
* @var KekRozsak\FrontBundle\Entity\User
*/
private $updated_by;
/** /**
* Get id * Get id
* *
@ -70,6 +31,12 @@ class Article
return $this->id; return $this->id;
} }
/**
* @var string $title
* @ORM\Column(type="string", length=100, nullable=false)
*/
private $title;
/** /**
* Set title * Set title
* *
@ -92,6 +59,12 @@ class Article
return $this->title; return $this->title;
} }
/**
* @var string $slug
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
*/
private $slug;
/** /**
* Set slug * Set slug
* *
@ -114,6 +87,12 @@ class Article
return $this->slug; return $this->slug;
} }
/**
* @var text $text
* @ORM\Column(type="text", nullable=false)
*/
private $text;
/** /**
* Set text * Set text
* *
@ -136,6 +115,12 @@ class Article
return $this->text; return $this->text;
} }
/**
* @var string $source
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $source;
/** /**
* Set source * Set source
* *
@ -159,139 +144,200 @@ class Article
} }
/** /**
* Set created_at * @var DateTime $createdAt
* @ORM\Column(type="datetime", nullable=false, name="created_at")
*/
private $createdAt;
/**
* Set createdAt
* *
* @param DateTime $createdAt * @param DateTime $createdAt
* @return Article * @return Article
*/ */
public function setCreatedAt(\DateTime $createdAt) public function setCreatedAt(\DateTime $createdAt)
{ {
$this->created_at = $createdAt; $this->createdAt = $createdAt;
return $this; return $this;
} }
/** /**
* Get created_at * Get createdAt
* *
* @return DateTime * @return DateTime
*/ */
public function getCreatedAt() public function getCreatedAt()
{ {
return $this->created_at; return $this->createdAt;
} }
/** /**
* Set updated_at * @var User $createdBy
* @ORM\ManyToOne(targetEntity="User", inversedBy="articles")
* @ORM\JoinColumn(name="created_by_id", referencedColumnName="id")
*/
private $createdBy;
/**
* Set createdBy
*
* @param User $createdBy
* @return Article
*/
public function setCreatedBy(User $createdBy = null)
{
$this->createdBy = $createdBy;
return $this;
}
/**
* Get createdBy
*
* @return User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* @var DateTime $updatedAt
* @ORM\Column(type="datetime", nullable=true, name="updated_at")
*/
private $updatedAt;
/**
* Set updatedAt
* *
* @param DateTime $updatedAt * @param DateTime $updatedAt
* @return Article * @return Article
*/ */
public function setUpdatedAt(\DateTime $updatedAt) public function setUpdatedAt(\DateTime $updatedAt)
{ {
$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 $updatedBy
* @ORM\ManyToOne(targetEntity="User")
* @ORM\JoinColumn(name="updated_by_id", referencedColumnName="id")
*/
private $updatedBy;
/**
* Set updatedBy
*
* @param User $updatedBy
* @return Article
*/
public function setUpdatedBy(User $updatedBy = null)
{
$this->updatedBy = $updatedBy;
return $this;
}
/**
* Get updatedBy
*
* @return User
*/
public function getUpdatedBy()
{
return $this->updatedBy;
}
/**
* @var text $updateReason
* @ORM\Column(type="text", nullable=true, name="update_reason")
*/
private $updateReason;
/**
* Set updateReason
* *
* @param text $updateReason * @param text $updateReason
* @return Article * @return Article
*/ */
public function setUpdateReason($updateReason) public function setUpdateReason($updateReason)
{ {
$this->update_reason = $updateReason; $this->updateReason = $updateReason;
return $this; return $this;
} }
/** /**
* Get update_reason * Get updateReason
* *
* @return text * @return text
*/ */
public function getUpdateReason() public function getUpdateReason()
{ {
return $this->update_reason; return $this->updateReason;
} }
/** /**
* Set created_by * @var boolean $mainPage
* * @ORM\Column(type="boolean", name="main_page", nullable=true)
* @param KekRozsak\FrontBundle\Entity\User $createdBy
* @return Article
*/ */
public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy = null) private $mainPage;
{
$this->created_by = $createdBy;
return $this;
}
/** /**
* Get created_by * Set mainPage
*
* @return KekRozsak\FrontBundle\Entity\User
*/
public function getCreatedBy()
{
return $this->created_by;
}
/**
* Set updated_by
*
* @param KekRozsak\FrontBundle\Entity\User $updatedBy
* @return Article
*/
public function setUpdatedBy(\KekRozsak\FrontBundle\Entity\User $updatedBy = null)
{
$this->updated_by = $updatedBy;
return $this;
}
/**
* Get updated_by
*
* @return KekRozsak\FrontBundle\Entity\User
*/
public function getUpdatedBy()
{
return $this->updated_by;
}
/**
* @var boolean $main_page
*/
private $main_page;
/**
* Set main_page
* *
* @param boolean $mainPage * @param boolean $mainPage
* @return Article * @return Article
*/ */
public function setMainPage($mainPage) public function setMainPage($mainPage)
{ {
$this->main_page = $mainPage; $this->mainPage = $mainPage;
return $this; return $this;
} }
/** /**
* Get main_page * Get mainPage
* *
* @return boolean * @return boolean
*/ */
public function getMainPage() public function getMainPage()
{ {
return $this->main_page; return $this->mainPage;
}
/**
* @var boolean $public
* @ORM\Column(type="boolean", nullable=false)
*/
private $public;
/**
* Set public
*
* @param boolean $public
* @return Article
*/
public function setPublic($public)
{
$this->public = $public;
return $this;
}
/**
* Get public
*
* @return boolean
*/
public function getPublic()
{
return $this->public;
} }
} }

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,55 +4,25 @@ 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
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/ */
private $id; private $id;
/**
* @var datetime $created_at
*/
private $created_at;
/**
* @var datetime $updated_at
*/
private $updated_at;
/**
* @var string $update_reason
*/
private $update_reason;
/**
* @var text $text
*/
private $text;
/**
* @var KekRozsak\FrontBundle\Entity\User
*/
private $created_by;
/**
* @var KekRozsak\FrontBundle\Entity\User
*/
private $updated_by;
/**
* @var KekRozsak\FrontBundle\Entity\ForumTopic
*/
private $topic;
/** /**
* Get id * Get id
* *
@ -64,75 +34,187 @@ class ForumPost
} }
/** /**
* Set created_at * @var datetime $createdAt
* @ORM\Column(type="datetime", name="created_at", nullable=false)
*/
private $createdAt;
/**
* Set createdAt
* *
* @param datetime $createdAt * @param DateTime $createdAt
* @return ForumPost * @return ForumPost
*/ */
public function setCreatedAt($createdAt) public function setCreatedAt($createdAt)
{ {
$this->created_at = $createdAt; $this->createdAt = $createdAt;
return $this; return $this;
} }
/** /**
* Get created_at * Get createdAt
* *
* @return datetime * @return DateTime
*/ */
public function getCreatedAt() public function getCreatedAt()
{ {
return $this->created_at; return $this->createdAt;
} }
/** /**
* Set updated_at * @var User $createdBy
* @ORM\ManyToOne(targetEntity="User", inversedBy="forumPosts")
* @ORM\JoinColumn(name="created_by_id", referencedColumnName="id")
*/
private $createdBy;
/**
* Set createdBy
* *
* @param datetime $updatedAt * @param User $createdBy
* @return ForumPost * @return ForumPost
*/ */
public function setUpdatedAt($updatedAt) public function setCreatedBy(User $createdBy)
{ {
$this->updated_at = $updatedAt; $this->createdBy = $createdBy;
return $this; return $this;
} }
/** /**
* Get updated_at * Get createdBy
* *
* @return datetime * @return User
*/ */
public function getUpdatedAt() public function getCreatedBy()
{ {
return $this->updated_at; return $this->createdBy;
} }
/** /**
* Set update_reason * @var datetime $updatedAt
* @ORM\Column(type="datetime", name="updated_at", nullable=true)
*/
private $updatedAt;
/**
* Set updatedAt
*
* @param DateTime $updatedAt
* @return ForumPost
*/
public function setUpdatedAt(\DateTime $updatedAt = null)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt
*
* @return DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* @var User $updatedBy
* @ORM\ManyToOne(targetEntity="User")
* @ORM\JoinColumn(name="updated_by_id", referencedColumnName="id")
*/
private $updatedBy;
/**
* Set updatedBy
*
* @param User $updatedBy
* @return ForumPost
*/
public function setUpdatedBy(User $updatedBy = null)
{
$this->updatedBy = $updatedBy;
return $this;
}
/**
* Get updatedBy
*
* @return User
*/
public function getUpdatedBy()
{
return $this->updatedBy;
}
/**
* @var string $updateReason
* @ORM\Column(type="text", name="update_reason", nullable=true)
*/
private $updateReason;
/**
* Set updateReason
* *
* @param string $updateReason * @param string $updateReason
* @return ForumPost * @return ForumPost
*/ */
public function setUpdateReason($updateReason) public function setUpdateReason($updateReason = null)
{ {
$this->update_reason = $updateReason; $this->updateReason = $updateReason;
return $this; return $this;
} }
/** /**
* Get update_reason * Get updateReason
* *
* @return string * @return string
*/ */
public function getUpdateReason() public function getUpdateReason()
{ {
return $this->update_reason; return $this->updateReason;
} }
/**
* @var ForumTopic $topic
* @ORM\ManyToOne(targetEntity="ForumTopic", inversedBy="posts")
*/
private $topic;
/**
* Set topic
*
* @param ForumTopic $topic
* @return ForumPost
*/
public function setTopic(ForumTopic $topic)
{
$this->topic = $topic;
if (($this->topic->getLastPost() === null) || ($this->topic->getLastPost()->getCreatedAt() > $this->createdAt))
$topic->setLastPost($this);
return $this;
}
/**
* Get topic
*
* @return ForumTopic
*/
public function getTopic()
{
return $this->topic;
}
/**
* @var text $text
* @ORM\Column(type="text", nullable=false)
*/
private $text;
/** /**
* Set text * Set text
* *
* @param text $text * @param string $text
* @return ForumPost * @return ForumPost
*/ */
public function setText($text) public function setText($text)
@ -144,77 +226,10 @@ class ForumPost
/** /**
* Get text * Get text
* *
* @return text * @return string
*/ */
public function getText() public function getText()
{ {
return $this->text; return $this->text;
} }
/**
* Set created_by
*
* @param KekRozsak\FrontBundle\Entity\User $createdBy
* @return ForumPost
*/
public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy = null)
{
$this->created_by = $createdBy;
return $this;
}
/**
* Get created_by
*
* @return KekRozsak\FrontBundle\Entity\User
*/
public function getCreatedBy()
{
return $this->created_by;
}
/**
* Set updated_by
*
* @param KekRozsak\FrontBundle\Entity\User $updatedBy
* @return ForumPost
*/
public function setUpdatedBy(\KekRozsak\FrontBundle\Entity\User $updatedBy = null)
{
$this->updated_by = $updatedBy;
return $this;
}
/**
* Get updated_by
*
* @return KekRozsak\FrontBundle\Entity\User
*/
public function getUpdatedBy()
{
return $this->updated_by;
}
/**
* Set topic
*
* @param ForumTopic $topic
* @return ForumPost
*/
public function setTopic(ForumTopic $topic)
{
$this->topic = $topic;
$topic->setLastPost($this);
return $this;
}
/**
* Get topic
*
* @return KekRozsak\FrontBundle\Entity\ForumTopic
*/
public function getTopic()
{
return $this->topic;
}
} }

View File

@ -4,57 +4,30 @@ 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()
{
$this->posts = new \Doctrine\Common\Collections\ArrayCollection();
}
/** /**
* @var integer $id * @var integer $id
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/ */
private $id; private $id;
/**
* @var string $title
*/
private $title;
/**
* @var string $slug
*/
private $slug;
/**
* @var datetime $created_at
*/
private $created_at;
/**
* @var datetime $updated_at
*/
private $updated_at;
/**
* @var text $update_reason
*/
private $update_reason;
/**
* @var KekRozsak\FrontBundle\Entity\User
*/
private $created_by;
/**
* @var KekRozsak\FrontBundle\Entity\User
*/
private $updated_by;
/**
* @var KekRozsak\FrontBundle\Entity\ForumTopicGroup
*/
private $topic_group;
/** /**
* Get id * Get id
* *
@ -65,6 +38,12 @@ class ForumTopic
return $this->id; return $this->id;
} }
/**
* @var string $title
* @ORM\Column(type="string", length=100)
*/
private $title;
/** /**
* Set title * Set title
* *
@ -87,6 +66,12 @@ class ForumTopic
return $this->title; return $this->title;
} }
/**
* @var string $slug
* @ORM\Column(type="string", length=100)
*/
private $slug;
/** /**
* Set slug * Set slug
* *
@ -110,153 +95,188 @@ class ForumTopic
} }
/** /**
* Set created_at * @var datetime $createdAt
* @ORM\Column(type="datetime", name="created_at")
*/
private $createdAt;
/**
* Set createdAt
* *
* @param datetime $createdAt * @param DateTime $createdAt
* @return ForumTopic * @return ForumTopic
*/ */
public function setCreatedAt($createdAt) public function setCreatedAt($createdAt)
{ {
$this->created_at = $createdAt; $this->createdAt = $createdAt;
return $this; return $this;
} }
/** /**
* Get created_at * Get createdAt
* *
* @return datetime * @return DateTime
*/ */
public function getCreatedAt() public function getCreatedAt()
{ {
return $this->created_at; return $this->createdAt;
} }
/** /**
* Set updated_at * @var User
* @ORM\ManyToOne(targetEntity="User")
* @ORM\JoinColumn(name="created_by_id")
*/
private $createdBy;
/**
* Set createdBy
*
* @param User $createdBy
* @return ForumTopic
*/
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 * @param datetime $updatedAt
* @return ForumTopic * @return ForumTopic
*/ */
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")
* @ORM\JoinColumn(name="updated_by_id")
*/
private $updatedBy;
/**
* Set updatedBy
*
* @param User $updatedBy
* @return ForumTopic
*/
public function setUpdatedBy(User $updatedBy = null)
{
$this->updatedBy = $updatedBy;
return $this;
}
/**
* Get updatedBy
*
* @return User
*/
public function getUpdatedBy()
{
return $this->updatedBy;
}
/**
* @var text $updateReason
* @ORM\Column(type="text", name="update_reason")
*/
private $updateReason;
/**
* Set updateReason
* *
* @param text $updateReason * @param text $updateReason
* @return ForumTopic * @return ForumTopic
*/ */
public function setUpdateReason($updateReason) public function setUpdateReason($updateReason)
{ {
$this->update_reason = $updateReason; $this->updateReason = $updateReason;
return $this; return $this;
} }
/** /**
* Get update_reason * Get updateReason
* *
* @return text * @return text
*/ */
public function getUpdateReason() public function getUpdateReason()
{ {
return $this->update_reason; return $this->updateReason;
} }
/** /**
* Set created_by * @var ForumTopicGroup
* @ORM\ManyToOne(targetEntity="ForumTopicGroup")
* @ORM\JoinColumn(name="topic_group_id", referencedColumnName="id")
*/
private $topicGroup;
/**
* Set topicGroup
* *
* @param KekRozsak\FrontBundle\Entity\User $createdBy * @param ForumTopicGroup $topicGroup
* @return ForumTopic * @return ForumTopic
*/ */
public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy = null) public function setTopicGroup(ForumTopicGroup $topicGroup)
{ {
$this->created_by = $createdBy; $this->topicGroup = $topicGroup;
return $this; return $this;
} }
/** /**
* Get created_by * Get topicGroup
* *
* @return KekRozsak\FrontBundle\Entity\User * @return ForumTopicGroup
*/
public function getCreatedBy()
{
return $this->created_by;
}
/**
* Set updated_by
*
* @param KekRozsak\FrontBundle\Entity\User $updatedBy
* @return ForumTopic
*/
public function setUpdatedBy(\KekRozsak\FrontBundle\Entity\User $updatedBy = null)
{
$this->updated_by = $updatedBy;
return $this;
}
/**
* Get updated_by
*
* @return KekRozsak\FrontBundle\Entity\User
*/
public function getUpdatedBy()
{
return $this->updated_by;
}
/**
* Set topic_group
*
* @param KekRozsak\FrontBundle\Entity\ForumTopicGroup $topicGroup
* @return ForumTopic
*/
public function setTopicGroup(\KekRozsak\FrontBundle\Entity\ForumTopicGroup $topicGroup = null)
{
$this->topic_group = $topicGroup;
return $this;
}
/**
* Get topic_group
*
* @return KekRozsak\FrontBundle\Entity\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()
{
$this->posts = new \Doctrine\Common\Collections\ArrayCollection();
}
/** /**
* Add posts * Add posts
* *
* @param KekRozsak\FrontBundle\Entity\ForumPost $posts * @param ForumPost $posts
* @return ForumTopic * @return ForumTopic
*/ */
public function addForumPost(\KekRozsak\FrontBundle\Entity\ForumPost $posts) public function addForumPost(ForumPost $posts)
{ {
$this->posts[] = $posts; $this->posts[] = $posts;
return $this; return $this;
@ -271,38 +291,34 @@ class ForumTopic
{ {
return $this->posts; return $this->posts;
} }
/** /**
* @var KekRozsak\FrontBundle\Entity\ForumPost * @var ForumPost
* @ORM\OneToOne(targetEntity="ForumPost", cascade={"persist"})
* @ORM\JoinColumn(name="last_post_id", referencedColumnName="id")
*/ */
private $lastPost; 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,52 +4,30 @@ 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()
{
$this->topic = new \Doctrine\Common\Collections\ArrayCollection();
}
/** /**
* @var integer $id * @var integer $id
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/ */
private $id; private $id;
/**
* @var string $title
*/
private $title;
/**
* @var string $slug
*/
private $slug;
/**
* @var datetime $created_at
*/
private $created_at;
/**
* @var datetime $updated_at
*/
private $updated_at;
/**
* @var text $update_reason
*/
private $update_reason;
/**
* @var KekRozsak\FrontBundle\Entity\User
*/
private $created_by;
/**
* @var KekRozsak\FrontBundle\Entity\User
*/
private $updated_by;
/** /**
* Get id * Get id
* *
@ -60,6 +38,12 @@ class ForumTopicGroup
return $this->id; return $this->id;
} }
/**
* @var string $title
* @ORM\Column(type="string", length=100, unique=true)
*/
private $title;
/** /**
* Set title * Set title
* *
@ -82,6 +66,12 @@ class ForumTopicGroup
return $this->title; return $this->title;
} }
/**
* @var string $slug
* @ORM\Column(type="string", length=100, unique=true)
*/
private $slug;
/** /**
* Set slug * Set slug
* *
@ -105,151 +95,182 @@ class ForumTopicGroup
} }
/** /**
* Set created_at * @var datetime $createdAt
* @ORM\Column(type="datetime", name="created_at")
*/
private $createdAt;
/**
* Set createdAt
* *
* @param datetime $createdAt * @param DateTime $createdAt
* @return ForumTopicGroup * @return ForumTopicGroup
*/ */
public function setCreatedAt($createdAt) public function setCreatedAt(\DateTime $createdAt)
{ {
$this->created_at = $createdAt; $this->createdAt = $createdAt;
return $this; return $this;
} }
/** /**
* Get created_at * Get createdAt
* *
* @return datetime * @return DateTime
*/ */
public function getCreatedAt() public function getCreatedAt()
{ {
return $this->created_at; return $this->createdAt;
} }
/** /**
* Set updated_at * @var User
* @ORM\ManyToOne(targetEntity="User")
* @ORM\JoinColumn(name="created_by_id")
*/
private $createdBy;
/**
* Set createdBy
* *
* @param datetime $updatedAt * @param User $createdBy
* @return ForumTopicGroup * @return ForumTopicGroup
*/ */
public function setUpdatedAt($updatedAt) public function setCreatedBy(User $createdBy)
{ {
$this->updated_at = $updatedAt; $this->createdBy = $createdBy;
return $this; return $this;
} }
/** /**
* Get updated_at * 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 ForumTopicGroup
*/
public function setUpdatedAt(\DateTime $updatedAt = null)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* 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")
* @ORM\JoinColumn(name="updated_by_id")
*/
private $updatedBy;
/**
* Set updatedBy
* *
* @param text $updateReason * @param User $updatedBy
* @return ForumTopicGroup * @return ForumTopicGroup
*/ */
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 User
*/
public function getUpdatedBy()
{
return $this->updatedBy;
}
/**
* @var text $update_reason
* @ORM\Column(type="text", name="update_reason", nullable=true)
*/
private $updateReason;
/**
* Set updateReason
*
* @param text $updateReason
* @return ForumTopicGroup
*/
public function setUpdateReason($updateReason = null)
{
$this->updateReason = $updateReason;
return $this;
}
/**
* Get updateReason
* *
* @return text * @return text
*/ */
public function getUpdateReason() public function getUpdateReason()
{ {
return $this->update_reason; return $this->updateReason;
} }
/** /**
* Set created_by * @var ForumPost
* @ORM\OneToOne(targetEntity="ForumPost", cascade={"persist"})
* @ORM\JoinColumn(name="last_post_id")
*/
private $lastPost;
/**
* Set lastPost
* *
* @param KekRozsak\FrontBundle\Entity\User $createdBy * @param ForumPost $lastPost
* @return ForumTopicGroup * @return ForumTopicGroup
*/ */
public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy = null) public function setLastPost(ForumPost $lastPost = null)
{ {
$this->created_by = $createdBy; $this->lastPost = $lastPost;
return $this; return $this;
} }
/** /**
* Get created_by * Get lastPost
* *
* @return KekRozsak\FrontBundle\Entity\User * @return ForumPost
*/ */
public function getCreatedBy() public function getLastPost()
{ {
return $this->created_by; return $this->lastPost;
} }
/**
* Set updated_by
*
* @param KekRozsak\FrontBundle\Entity\User $updatedBy
* @return ForumTopicGroup
*/
public function setUpdatedBy(\KekRozsak\FrontBundle\Entity\User $updatedBy = null)
{
$this->updated_by = $updatedBy;
return $this;
}
/**
* Get updated_by
*
* @return KekRozsak\FrontBundle\Entity\User
*/
public function getUpdatedBy()
{
return $this->updated_by;
}
/**
* @var \Doctrine\Common\Collections\ArrayCollection
*/
private $topic;
public function __construct()
{
$this->topic = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* 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
*
* @return Doctrine\Common\Collections\Collection
*/
public function getTopic()
{
return $this->topic;
}
/** /**
* @var \Doctrine\Common\Collections\ArrayCollection * @var \Doctrine\Common\Collections\ArrayCollection
* @ORM\OneToMany(targetEntity="ForumTopic", mappedBy="topicGroup")
*/ */
private $topics; private $topics;
/** /**
* Get topics * Get topics
* *
@ -259,37 +280,4 @@ class ForumTopicGroup
{ {
return $this->topics; return $this->topics;
} }
/**
* @var KekRozsak\FrontBundle\Entity\ForumPost
*/
private $lastPost;
/**
* Set lastPost
*
* @param KekRozsak\FrontBundle\Entity\ForumPost $lastPost
* @return ForumTopicGroup
*/
public function setLastPost(\KekRozsak\FrontBundle\Entity\ForumPost $lastPost = null)
{
$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,55 +6,19 @@ 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
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer", name="id")
*/ */
private $id; private $id;
/**
* @var datetime $created_at
*/
private $created_at;
/**
* @var datetime $updated_at
*/
private $updated_at;
/**
* @var text $update_reason
*/
private $update_reason;
/**
* @var string $title
*/
private $title;
/**
* @var string $slug
*/
private $slug;
/**
* @var text $text
*/
private $text;
/**
* @var KekRozsak\FrontBundle\Entity\User
*/
private $created_by;
/**
* @var KekRozsak\FrontBundle\Entity\User
*/
private $updated_by;
/** /**
* Get id * Get id
* *
@ -66,69 +30,119 @@ class News
} }
/** /**
* Set created_at * @var datetime $createdAt
* @ORM\Column(type="datetime", name="created_at")
*/
private $createdAt;
/**
* Set createdAt
* *
* @param datetime $createdAt * @param datetime $createdAt
* @return News * @return News
*/ */
public function setCreatedAt($createdAt) public function setCreatedAt($createdAt)
{ {
$this->created_at = $createdAt; $this->createdAt = $createdAt;
return $this; return $this;
} }
/** /**
* Get created_at * Get createdAt
* *
* @return datetime * @return datetime
*/ */
public function getCreatedAt() public function getCreatedAt()
{ {
return $this->created_at; return $this->createdAt;
} }
/** /**
* Set updated_at * @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 string $title
* @ORM\Column(type="string", length=100, nullable=false)
*/
private $title;
/**
* @var string $slug
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
*/
private $slug;
/**
* @var text $text
* @ORM\Column(type="text", nullable=true)
*/
private $text;
/**
* @var KekRozsak\FrontBundle\Entity\User $createdBy
* @ORM\ManyToOne(targetEntity="User")
* @ORM\JoinColumn(name="created_by_id", referencedColumnName="id")
*/
private $createdBy;
/**
* @var KekRozsak\FrontBundle\Entity\User $updatedBy
* @ORM\ManyToOne(targetEntity="User", fetch="EXTRA_LAZY")
* @ORM\JoinColumn(name="updated_by_id", referencedColumnName="id")
*/
private $updatedBy;
/**
* Set updatedAt
* *
* @param datetime $updatedAt * @param datetime $updatedAt
* @return News * @return News
*/ */
public function setUpdatedAt($updatedAt) public function setUpdatedAt($updatedAt)
{ {
$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 * Set updateReason
* *
* @param text $updateReason * @param text $updateReason
* @return News * @return News
*/ */
public function setUpdateReason($updateReason) public function setUpdateReason($updateReason)
{ {
$this->update_reason = $updateReason; $this->updateReason = $updateReason;
return $this; return $this;
} }
/** /**
* Get update_reason * Get updateReason
* *
* @return text * @return text
*/ */
public function getUpdateReason() public function getUpdateReason()
{ {
return $this->update_reason; return $this->updateReason;
} }
/** /**
@ -198,46 +212,46 @@ class News
} }
/** /**
* Set created_by * Set createdBy
* *
* @param KekRozsak\FrontBundle\Entity\User $createdBy * @param KekRozsak\FrontBundle\Entity\User $createdBy
* @return News * @return News
*/ */
public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy = null) public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy = null)
{ {
$this->created_by = $createdBy; $this->createdBy = $createdBy;
return $this; return $this;
} }
/** /**
* Get created_by * Get createdBy
* *
* @return KekRozsak\FrontBundle\Entity\User * @return KekRozsak\FrontBundle\Entity\User
*/ */
public function getCreatedBy() public function getCreatedBy()
{ {
return $this->created_by; return $this->createdBy;
} }
/** /**
* Set updated_by * Set updatedBy
* *
* @param KekRozsak\FrontBundle\Entity\User $updatedBy * @param KekRozsak\FrontBundle\Entity\User $updatedBy
* @return News * @return News
*/ */
public function setUpdatedBy(\KekRozsak\FrontBundle\Entity\User $updatedBy = null) public function setUpdatedBy(\KekRozsak\FrontBundle\Entity\User $updatedBy = null)
{ {
$this->updated_by = $updatedBy; $this->updatedBy = $updatedBy;
return $this; return $this;
} }
/** /**
* Get updated_by * Get updatedBy
* *
* @return KekRozsak\FrontBundle\Entity\User * @return KekRozsak\FrontBundle\Entity\User
*/ */
public function getUpdatedBy() public function getUpdatedBy()
{ {
return $this->updated_by; return $this->updatedBy;
} }
} }

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,52 +5,34 @@ 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
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/ */
private $id; private $id;
/**
* @var string $username
*/
private $username;
/**
* @var string $password
*/
private $password;
/**
* @var string $email
*/
private $email;
/**
* @var DateTime $registered_at
*/
private $registered_at;
/**
* @var string $display_name
*/
private $display_name;
/**
* @var \Doctrine\Common\Collections\ArrayCollection
*/
private $roles;
public function __construct()
{
$this->roles = new \Doctrine\Common\Collections\ArrayCollection();
}
/** /**
* Get id * Get id
* *
@ -61,6 +43,13 @@ class User implements UserInterface, AdvancedUserInterface
return $this->id; return $this->id;
} }
/**
* @var string $username
* @ORM\Column(type="string", length=50, nullable=false, unique=true)
* @Assert\NotBlank(groups={"registration"})
*/
private $username;
/** /**
* Set username * Set username
* *
@ -83,6 +72,13 @@ class User implements UserInterface, AdvancedUserInterface
return $this->username; return $this->username;
} }
/**
* @var string $password
* @ORM\Column(type="string", length=50, nullable=false)
* @Assert\NotBlank(groups={"registration"})
*/
private $password;
/** /**
* Set password * Set password
* *
@ -105,6 +101,14 @@ class User implements UserInterface, AdvancedUserInterface
return $this->password; return $this->password;
} }
/**
* @var string $email
* @ORM\Column(type="string", length=50, unique=true, nullable=false)
* @Assert\NotBlank(groups={"registration"})
* @Assert\Email(groups={"registration"})
*/
private $email;
/** /**
* Set email * Set email
* *
@ -128,102 +132,134 @@ class User implements UserInterface, AdvancedUserInterface
} }
/** /**
* Set registered_at * @var DateTime $registeredAt
* @ORM\Column(type="datetime", name="registered_at", nullable=false)
* @Assert\NotBlank()
* TODO: original validation.yml contained Type: \DateTime
* Assert\Type("\\DateTime")
*/
private $registeredAt;
/**
* Set registeredAt
* *
* @param DateTime $registeredAt * @param DateTime $registeredAt
* @return User * @return User
*/ */
public function setRegisteredAt(\DateTime $registeredAt) public function setRegisteredAt(\DateTime $registeredAt)
{ {
$this->registered_at = $registeredAt; $this->registeredAt = $registeredAt;
return $this; return $this;
} }
/** /**
* Get registered_at * Get registeredAt
* *
* @return DateTime * @return DateTime
*/ */
public function getRegisteredAt() public function getRegisteredAt()
{ {
return $this->registered_at; return $this->registeredAt;
} }
/** /**
* Set display_name * @var string $displayName
* @ORM\Column(type="string", length=50, nullable=false, unique=true, name="display_name")
*/
private $displayName;
/**
* Set displayName
* *
* @param string $displayName * @param string $displayName
* @return User * @return User
*/ */
public function setDisplayName($displayName) public function setDisplayName($displayName)
{ {
$this->display_name = $displayName; $this->displayName = $displayName;
return $this; return $this;
} }
/** /**
* Get display_name * Get displayName
* *
* @return string * @return string
*/ */
public function getDisplayName() public function getDisplayName()
{ {
return $this->display_name; return $this->displayName;
} }
/** /**
* Add roles * @var User $acceptedBy
* @ORM\ManyToOne(targetEntity="User", fetch="EXTRA_LAZY")
* @ORM\JoinColumn(name="accepted_by_id", referencedColumnName="id")
*/
private $acceptedBy;
/**
* 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
* @ORM\Column(type="datetime", nullable=true, name="last_login_at")
*/
private $lastLoginAt;
/**
* Set lastLoginAt
*
* @param DateTime $lastLoginAt
* @return User
*/
public function setLastLoginAt(\DateTime $lastLoginAt = null)
{ {
return $this->roles; $this->lastLoginAt = $lastLoginAt;
return $this;
} }
public function eraseCredentials() /**
* Get lastLoginAt
*
* @return DateTime
*/
public function getLastLoginAt()
{ {
return $this->lastLoginAt;
} }
public function getSalt()
{
return $this->password;
}
/** /**
* @var \Doctrine\Common\Collections\ArrayCollection * @var \Doctrine\Common\Collections\ArrayCollection
* @ORM\OneToMany(targetEntity="Article", mappedBy="createdBy", fetch="EXTRA_LAZY")
*/ */
private $articles; private $articles;
/**
* @var \Doctrine\Common\Collections\ArrayCollection
*/
private $forum_posts;
/** /**
* Add articles * Add articles
* *
* @param KekRozsak\FrontBundle\Entity\Article $articles * @param Article $articles
* @return User * @return User
*/ */
public function addArticle(\KekRozsak\FrontBundle\Entity\Article $articles) public function addArticle(Article $articles)
{ {
$this->articles[] = $articles; $this->articles[] = $articles;
return $this; return $this;
@ -240,125 +276,213 @@ class User implements UserInterface, AdvancedUserInterface
} }
/** /**
* Add forum_posts * @var \Doctrine\Common\Collections\ArrayCollection
* @ORM\OneToMany(targetEntity="ForumPost", mappedBy="createdBy", fetch="EXTRA_LAZY")
*/
private $forumPosts;
/**
* 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 * @var \Doctrine\Common\Collections\ArrayCollection $ledGroups
* @ORM\OneToMany(targetEntity="Group", mappedBy="leader", fetch="EXTRA_LAZY")
*/ */
private $accepted_by; 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;
} }
/**
* @var \Doctrine\Common\Collections\ArrayCollection $createdDocuments
* @ORM\OneToMany(targetEntity="Document", mappedBy="createdBy", fetch="EXTRA_LAZY")
*/
private $createdDocuments;
/**
* Add createdDocuments
*
* @param Document $document
* @return User
*/
public function addDocument(Document $document)
{
$this->createdDocuments[] = $document;
return $this;
}
/**
* Get createdDocuments
*
* @return Doctrine\Common\Collections\Collection
*/
public function getCreatedDocuments()
{
return $this->createdDocuments;
}
/**
* @var UserData $userData
* @ORM\OneToOne(targetEntity="UserData", mappedBy="user", fetch="EXTRA_LAZY", cascade={"persist"})
* @ORM\JoinColumn(name="id", referencedColumnName="user_id")
*/
private $userData;
/**
* Set userData
*
* @param UserData $userData
* @return User
*/
public function setUserData(UserData $userData = null)
{
$this->userData = $userData;
return $this;
}
/**
* Get userData
*
* @return UserData
*/
public function getUserData()
{
return $this->userData;
}
/**
* @var PollAnswer
* @ORM\ManyToMany(targetEntity="PollAnswer", mappedBy="voters", fetch="EXTRA_LAZY")
*/
private $pollVotes;
/**
* 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() public function isAccountNonExpired()
{ {
return true; return true;
} }
/**
* AdvancedUserInterface::isAccountNonLocked()
*/
public function isAccountNonLocked() public function isAccountNonLocked()
{ {
return true; return true;
} }
/**
* AdvancedUserInterface::isCredentialsNonExpired()
*/
public function isCredentialsNonExpired() public function isCredentialsNonExpired()
{ {
return true; return true;
} }
/**
* AdvancedUserInterface::isEnabled()
*/
public function isEnabled() public function isEnabled()
{ {
return ($this->accepted_by !== null); return ($this->acceptedBy !== null);
}
/**
* @var datetime $last_login_at
*/
private $last_login_at;
/**
* Set last_login_at
*
* @param datetime $lastLoginAt
* @return User
*/
public function setLastLoginAt($lastLoginAt)
{
$this->last_login_at = $lastLoginAt;
return $this;
}
/**
* Get last_login_at
*
* @return datetime
*/
public function getLastLoginAt()
{
return $this->last_login_at;
}
/**
* @var KekRozsak\FrontBundle\Entity\UserData
*/
private $user_data;
/**
* Set user_data
*
* @param KekRozsak\FrontBundle\Entity\UserData $userData
* @return User
*/
public function setUserData(\KekRozsak\FrontBundle\Entity\UserData $userData = null)
{
$this->user_data = $userData;
return $this;
}
/**
* Get user_data
*
* @return KekRozsak\FrontBundle\Entity\UserData
*/
public function getUserData()
{
return $this->user_data;
} }
} }

View File

@ -4,77 +4,80 @@ 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
* @ORM\OneToOne(targetEntity="User", inversedBy="userData")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/ */
private $user; protected $user;
/** /**
* Set user * Set user
* *
* @param KekRozsak\FrontBundle\Entity\User $user * @param User $user
* @return UserData * @return UserData
*/ */
public function setUser(\KekRozsak\FrontBundle\Entity\User $user = null) public function setUser(User $user = null)
{ {
$this->user = $user; $this->user = $user;
$this->user_id = $user->getId(); $this->userId = $user->getId();
return $this; return $this;
} }
/** /**
* Get user * Get user
* *
* @return KekRozsak\FrontBundle\Entity\User * @return User
*/ */
public function getUser() public function getUser()
{ {
return $this->user; return $this->user;
} }
/** /**
* @var integer $user_id * @var boolean $emailPublic
* @ORM\Column(type="boolean", name="email_public")
*/ */
private $user_id; protected $emailPublic;
/** /**
* @var string $realName * Set emailPublic
*/
private $realName;
/**
* @var boolean $realNamePublic
*/
private $realNamePublic;
/**
* Set user_id
* *
* @param integer $userId * @param boolean $emailPublic
* @return UserData * @return UserData
*/ */
public function setUserId($userId) public function setEmailPublic($emailPublic)
{ {
$this->user_id = $userId; $this->emailPublic = $emailPublic;
return $this; return $this;
} }
/** /**
* Get user_id * Get emailPublic
* *
* @return integer * @return boolean
*/ */
public function getUserId() public function getEmailPublic()
{ {
return $this->user_id; return $this->emailPublic;
} }
/**
* @var string $realName
* @ORM\Column(name="real_name", type="string", length=100, nullable=true)
*/
protected $realName;
/** /**
* Set realName * Set realName
* *
@ -97,6 +100,12 @@ class UserData
return $this->realName; return $this->realName;
} }
/**
* @var boolean $realNamePublic
* @ORM\Column(name="real_name_public", type="boolean", nullable=false)
*/
protected $realNamePublic;
/** /**
* Set realNamePublic * Set realNamePublic
* *
@ -118,16 +127,12 @@ class UserData
{ {
return $this->realNamePublic; return $this->realNamePublic;
} }
/** /**
* @var text $selfDescription * @var text $selfDescription
* @ORM\Column(name="self_description", type="text", nullable=true)
*/ */
private $selfDescription; protected $selfDescription;
/**
* @var boolean $emailPublic
*/
private $emailPublic;
/** /**
* Set selfDescription * Set selfDescription
@ -151,57 +156,11 @@ class UserData
return $this->selfDescription; return $this->selfDescription;
} }
/**
* Set emailPublic
*
* @param boolean $emailPublic
* @return UserData
*/
public function setEmailPublic($emailPublic)
{
$this->emailPublic = $emailPublic;
return $this;
}
/**
* Get emailPublic
*
* @return boolean
*/
public function getEmailPublic()
{
return $this->emailPublic;
}
/** /**
* @var string $msnAddress * @var string $msnAddress
* @ORM\Column(type="string", length=100, name="msn_address", nullable=true)
*/ */
private $msnAddress; protected $msnAddress;
/**
* @var boolean $msnAddressPublic
*/
private $msnAddressPublic;
/**
* @var string $googleTalk
*/
private $googleTalk;
/**
* @var boolean $googleTalkPublic
*/
private $googleTalkPublic;
/**
* @var string $skype
*/
private $skype;
/**
* @var boolean $skypePublic
*/
private $skypePublic;
/** /**
* Set msnAddress * Set msnAddress
@ -225,6 +184,12 @@ class UserData
return $this->msnAddress; return $this->msnAddress;
} }
/**
* @var boolean $msnAddressPublic
* @ORM\Column(type="boolean", name="msn_address_public", nullable=false)
*/
protected $msnAddressPublic;
/** /**
* Set msnAddressPublic * Set msnAddressPublic
* *
@ -247,6 +212,12 @@ class UserData
return $this->msnAddressPublic; return $this->msnAddressPublic;
} }
/**
* @var string $googleTalk
* @ORM\Column(type="string", length=100, name="google_talk", nullable=true)
*/
protected $googleTalk;
/** /**
* Set googleTalk * Set googleTalk
* *
@ -269,6 +240,12 @@ class UserData
return $this->googleTalk; return $this->googleTalk;
} }
/**
* @var boolean $googleTalkPublic
* @ORM\Column(type="boolean", name="google_talk_public", nullable=false)
*/
protected $googleTalkPublic;
/** /**
* Set googleTalkPublic * Set googleTalkPublic
* *
@ -291,6 +268,12 @@ class UserData
return $this->googleTalkPublic; return $this->googleTalkPublic;
} }
/**
* @var string $skype
* @ORM\Column(type="string", length=100, nullable=true)
*/
protected $skype;
/** /**
* Set skype * Set skype
* *
@ -313,6 +296,12 @@ class UserData
return $this->skype; return $this->skype;
} }
/**
* @var boolean $skypePublic
* @ORM\Column(type="boolean", name="skype_public", nullable=false)
*/
protected $skypePublic;
/** /**
* Set skypePublic * Set skypePublic
* *
@ -334,16 +323,12 @@ class UserData
{ {
return $this->skypePublic; return $this->skypePublic;
} }
/** /**
* @var string $phoneNumber * @var string $phoneNumber
* @ORM\Column(type="string", length=30, name="phone_number", nullable=true)
*/ */
private $phoneNumber; protected $phoneNumber;
/**
* @var boolean $phoneNumberPublic
*/
private $phoneNumberPublic;
/** /**
* Set phoneNumber * Set phoneNumber
@ -351,7 +336,7 @@ class UserData
* @param string $phoneNumber * @param string $phoneNumber
* @return UserData * @return UserData
*/ */
public function setPhoneNumber($phoneNumber) public function setPhoneNumber($phoneNumber = null)
{ {
$this->phoneNumber = $phoneNumber; $this->phoneNumber = $phoneNumber;
return $this; return $this;
@ -367,6 +352,12 @@ class UserData
return $this->phoneNumber; return $this->phoneNumber;
} }
/**
* @var boolean $phoneNumberPublic
* @ORM\Column(type="boolean", name="phone_number_public", nullable=false)
*/
protected $phoneNumberPublic;
/** /**
* Set phoneNumberPublic * Set 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 %}