Upgraded to Symfony 2.1-beta2
This commit is contained in:
@@ -2,8 +2,9 @@
|
||||
|
||||
namespace KekRozsak\AdminBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
|
||||
/**
|
||||
* @Route("/admin")
|
||||
@@ -11,14 +12,15 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
class DefaultController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Route("/jelentkezok", name="KekRozsakAdminBundle_manage_reg")
|
||||
* @Route("/manage_regs", name="KekRozsakAdminBundle_manage_regs")
|
||||
* @Template()
|
||||
*/
|
||||
public function manageRegsAction()
|
||||
{
|
||||
$users = $this->getDoctrine()->getEntityManager()->createQuery('SELECT u FROM KekRozsakFrontBundle:User u WHERE u.acceptedBy IS NULL')->getResult();
|
||||
$users = $this->getDoctrine()->getEntityManager()->createQuery('SELECT u FROM KekRozsakSecurityBundle:User u WHERE u.acceptedBy IS NULL')->getResult();
|
||||
|
||||
return $this->render('KekRozsakAdminBundle:Default:manage_regs.html.twig', array (
|
||||
return array(
|
||||
'users' => $users,
|
||||
));
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +0,0 @@
|
||||
KekRozsakAdminBundle_manage_regs:
|
||||
pattern: /jelentkezok
|
||||
defaults:
|
||||
_controller: KekRozsakAdminBundle:Default:manageRegs
|
@@ -2,10 +2,12 @@
|
||||
|
||||
namespace KekRozsak\FrontBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
|
||||
use KekRozsak\FrontBundle\Form\Type\UserType;
|
||||
use KekRozsak\FrontBundle\Entity\UserData;
|
||||
use KekRozsak\SecurityBundle\Form\Type\UserType;
|
||||
|
||||
class DefaultController extends Controller
|
||||
{
|
||||
@@ -14,7 +16,7 @@ class DefaultController extends Controller
|
||||
*/
|
||||
public function homepageAction()
|
||||
{
|
||||
$mainPageArticle = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Article')->findOneBy(array('mainPage' => 1), true, array('createdAt', 'DESC'), 1);
|
||||
$mainPageArticle = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Article')->findOneBy(array('mainPage' => true), true, array('createdAt', 'DESC'), 1);
|
||||
if (!$mainPageArticle)
|
||||
throw $this->createNotFoundException('A keresett cikk nem létezik!');
|
||||
|
||||
@@ -23,6 +25,9 @@ class DefaultController extends Controller
|
||||
|
||||
/**
|
||||
* @Route("/cikk/{articleSlug}", name="KekRozsakFrontBundle_article")
|
||||
* @Template()
|
||||
*
|
||||
* @param string $articleSlug
|
||||
*/
|
||||
public function articleAction($articleSlug)
|
||||
{
|
||||
@@ -31,49 +36,43 @@ class DefaultController extends Controller
|
||||
if (!$article)
|
||||
throw $this->createNotFoundException('A keresett cikk nem létezik!');
|
||||
|
||||
return $this->render('KekRozsakFrontBundle:Default:article.html.twig', array(
|
||||
'article' => $article
|
||||
));
|
||||
return array(
|
||||
'article' => $article,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/profil", name="KekRozsakFrontBundle_profile_edit")
|
||||
* @Template("KekRozsakFrontBundle:Default:userprofile.html.twig")
|
||||
*/
|
||||
public function profileEditAction()
|
||||
{
|
||||
$user = $this->get('security.context')->getToken()->getUser();
|
||||
$oldPassword = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:User')->findOneById($user->getId())->getPassword();
|
||||
$form = $this->createForm(new UserType(), $user);
|
||||
|
||||
$oldPassword = $user->getPassword();
|
||||
$form = $this->createForm(new UserType(), $user);
|
||||
$saveSuccess = false;
|
||||
$request = $this->getRequest();
|
||||
|
||||
if ($request->getMethod() == 'POST')
|
||||
{
|
||||
$form->bindRequest($request);
|
||||
if ($form->isValid())
|
||||
{
|
||||
if ($user->getPassword() != '')
|
||||
{
|
||||
$user->setPassword($this->get('security.encoder_factory')->getEncoder($user)->encodePassword($user->getPassword(), $user->getSalt()));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->getPassword() == '')
|
||||
$user->setPassword($oldPassword);
|
||||
}
|
||||
if ($user->getUserData()->getUserId() === null)
|
||||
{
|
||||
$user->getUserData()->setUser($user);
|
||||
}
|
||||
else
|
||||
$user->setPassword($this->get('security.encoder_factory')->getEncoder($user)->encodePassword($user->getPassword(), $user->getSalt()));
|
||||
|
||||
$em = $this->getDoctrine()->getEntityManager();
|
||||
$em->persist($user);
|
||||
$em->flush();
|
||||
// $saveSuccess = true
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('KekRozsakFrontBundle:Default:userprofile.html.twig', array(
|
||||
return array(
|
||||
'form' => $form->createView(),
|
||||
'saveSuccess' => $saveSuccess,
|
||||
));
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -2,9 +2,10 @@
|
||||
|
||||
namespace KekRozsak\FrontBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
|
||||
use KekRozsak\FrontBundle\Entity\ForumPost;
|
||||
use KekRozsak\FrontBundle\Form\Type\ForumPostType;
|
||||
@@ -16,40 +17,42 @@ class ForumController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Route("", name="KekRozsakFrontBundle_forum_main")
|
||||
* @Template("KekRozsakFrontBundle:Forum:topic_group_list.html.twig")
|
||||
*/
|
||||
public function mainAction()
|
||||
{
|
||||
// TODO: Protect this controller with roles? It is also defined in security.yml
|
||||
$groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumTopicGroup');
|
||||
|
||||
// TODO: ORDER the topic list by last post date
|
||||
$topicGroups = $groupRepo->findAll();
|
||||
|
||||
return $this->render('KekRozsakFrontBundle:Forum:topic_group_list.html.twig', array(
|
||||
return array(
|
||||
'topicGroups' => $topicGroups,
|
||||
));
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{topicGroupSlug}", name="KekRozsakFrontBundle_forum_topic_list")
|
||||
* @Template("KekRozsakFrontBundle:Forum:topic_list.html.twig")
|
||||
*/
|
||||
public function topicListAction($topicGroupSlug)
|
||||
{
|
||||
$groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumTopicGroup');
|
||||
|
||||
if (!($topicGroup = $groupRepo->findOneBySlug($topicGroupSlug)))
|
||||
throw $this->createNotFoundException('A kért témakör nem létezik!');
|
||||
|
||||
return $this->render('KekRozsakFrontBundle:Forum:topic_list.html.twig', array(
|
||||
return array(
|
||||
'topicGroup' => $topicGroup,
|
||||
));
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{topicGroupSlug}/{topicSlug}", name="KekRozsakFrontBundle_forum_post_list")
|
||||
* @Template("KekRozsakFrontBundle:Forum:post_list.html.twig")
|
||||
*/
|
||||
public function postListAction($topicGroupSlug, $topicSlug)
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
// Get the topic group based on slug
|
||||
$groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumTopicGroup');
|
||||
if (!($topicGroup = $groupRepo->findOneBySlug($topicGroupSlug)))
|
||||
@@ -68,6 +71,7 @@ class ForumController extends Controller
|
||||
$post = new ForumPost();
|
||||
$form = $this->createForm(new ForumPostType($topicGroup->getId(), $topic->getId()), $post);
|
||||
|
||||
$request = $this->getRequest();
|
||||
if ($request->getMethod() == 'POST')
|
||||
{
|
||||
$form->bindRequest($request);
|
||||
@@ -89,12 +93,11 @@ class ForumController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('KekRozsakFrontBundle:Forum:post_list.html.twig', array(
|
||||
return array(
|
||||
'topicGroup' => $topicGroup,
|
||||
'topic' => $topic,
|
||||
'posts' => $posts,
|
||||
'form' => $form->createView(),
|
||||
));
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -4,10 +4,9 @@ namespace KekRozsak\FrontBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
use KekRozsak\FrontBundle\Entity\User;
|
||||
use KekRozsak\SecurityBundle\Entity\User;
|
||||
|
||||
/**
|
||||
* KekRozsak\FrontBundle\Entity\Article
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="articles")
|
||||
*/
|
||||
@@ -17,23 +16,80 @@ class Article
|
||||
* @var integer $id
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer", name="id")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
private $createdBy;
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return Article
|
||||
*/
|
||||
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime $createdAt
|
||||
* @ORM\Column(type="datetime", name="created_at", nullable=false)
|
||||
*/
|
||||
private $createdAt;
|
||||
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @return Article
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $title
|
||||
* @ORM\Column(type="string", length=100, nullable=false)
|
||||
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
|
||||
*/
|
||||
private $title;
|
||||
|
||||
@@ -52,7 +108,7 @@ class Article
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
@@ -80,7 +136,7 @@ class Article
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
@@ -88,7 +144,7 @@ class Article
|
||||
}
|
||||
|
||||
/**
|
||||
* @var text $text
|
||||
* @var string $text
|
||||
* @ORM\Column(type="text", nullable=false)
|
||||
*/
|
||||
private $text;
|
||||
@@ -96,7 +152,7 @@ class Article
|
||||
/**
|
||||
* Set text
|
||||
*
|
||||
* @param text $text
|
||||
* @param string $text
|
||||
* @return Article
|
||||
*/
|
||||
public function setText($text)
|
||||
@@ -108,186 +164,16 @@ class Article
|
||||
/**
|
||||
* Get text
|
||||
*
|
||||
* @return text
|
||||
* return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $source
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $source;
|
||||
|
||||
/**
|
||||
* Set source
|
||||
*
|
||||
* @param string $source
|
||||
* @return Article
|
||||
*/
|
||||
public function setSource($source)
|
||||
{
|
||||
$this->source = $source;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get source
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSource()
|
||||
{
|
||||
return $this->source;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime $createdAt
|
||||
* @ORM\Column(type="datetime", nullable=false, name="created_at")
|
||||
*/
|
||||
private $createdAt;
|
||||
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param DateTime $createdAt
|
||||
* @return Article
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var User $createdBy
|
||||
* @ORM\ManyToOne(targetEntity="User", inversedBy="articles")
|
||||
* @ORM\JoinColumn(name="created_by_id", referencedColumnName="id")
|
||||
*/
|
||||
private $createdBy;
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param User $createdBy
|
||||
* @return Article
|
||||
*/
|
||||
public function setCreatedBy(User $createdBy = null)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime $updatedAt
|
||||
* @ORM\Column(type="datetime", nullable=true, name="updated_at")
|
||||
*/
|
||||
private $updatedAt;
|
||||
|
||||
/**
|
||||
* Set updatedAt
|
||||
*
|
||||
* @param DateTime $updatedAt
|
||||
* @return Article
|
||||
*/
|
||||
public function setUpdatedAt(\DateTime $updatedAt)
|
||||
{
|
||||
$this->updatedAt = $updatedAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updatedAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getUpdatedAt()
|
||||
{
|
||||
return $this->updatedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var User $updatedBy
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="updated_by_id", referencedColumnName="id")
|
||||
*/
|
||||
private $updatedBy;
|
||||
|
||||
/**
|
||||
* Set updatedBy
|
||||
*
|
||||
* @param User $updatedBy
|
||||
* @return Article
|
||||
*/
|
||||
public function setUpdatedBy(User $updatedBy = null)
|
||||
{
|
||||
$this->updatedBy = $updatedBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updatedBy
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function getUpdatedBy()
|
||||
{
|
||||
return $this->updatedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var text $updateReason
|
||||
* @ORM\Column(type="text", nullable=true, name="update_reason")
|
||||
*/
|
||||
private $updateReason;
|
||||
|
||||
/**
|
||||
* Set updateReason
|
||||
*
|
||||
* @param text $updateReason
|
||||
* @return Article
|
||||
*/
|
||||
public function setUpdateReason($updateReason)
|
||||
{
|
||||
$this->updateReason = $updateReason;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updateReason
|
||||
*
|
||||
* @return text
|
||||
*/
|
||||
public function getUpdateReason()
|
||||
{
|
||||
return $this->updateReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var boolean $mainPage
|
||||
* @ORM\Column(type="boolean", name="main_page", nullable=true)
|
||||
* @ORM\Column(type="boolean", name="main_page")
|
||||
*/
|
||||
private $mainPage;
|
||||
|
||||
@@ -306,7 +192,7 @@ class Article
|
||||
/**
|
||||
* Get mainPage
|
||||
*
|
||||
* @return boolean
|
||||
* @return boolean
|
||||
*/
|
||||
public function getMainPage()
|
||||
{
|
||||
@@ -314,7 +200,7 @@ class Article
|
||||
}
|
||||
|
||||
/**
|
||||
* @var boolean $public
|
||||
* @var boolean public
|
||||
* @ORM\Column(type="boolean", nullable=false)
|
||||
*/
|
||||
private $public;
|
||||
@@ -325,7 +211,7 @@ class Article
|
||||
* @param boolean $public
|
||||
* @return Article
|
||||
*/
|
||||
public function setPublic($public)
|
||||
public function setPublic($public = false)
|
||||
{
|
||||
$this->public = $public;
|
||||
return $this;
|
||||
@@ -334,10 +220,39 @@ class Article
|
||||
/**
|
||||
* Get public
|
||||
*
|
||||
* @return boolean
|
||||
* @return boolean
|
||||
*/
|
||||
public function getPublic()
|
||||
public function isPublic()
|
||||
{
|
||||
return $this->public;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $source
|
||||
* @ORM\Column(type="string", nullable=true)
|
||||
*/
|
||||
private $source;
|
||||
|
||||
/**
|
||||
* Set source
|
||||
*
|
||||
* @param string $source
|
||||
* @return Article
|
||||
*/
|
||||
public function setSource($source = null)
|
||||
{
|
||||
$this->source = $source;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get source
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSource()
|
||||
{
|
||||
return $this->source;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2,14 +2,11 @@
|
||||
|
||||
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\ForumTopicGroup;
|
||||
|
||||
/**
|
||||
* KekRozsak\FrontBundle\Entity\ForumPost
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="forum_posts")
|
||||
*/
|
||||
@@ -26,7 +23,7 @@ class ForumPost
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
@@ -34,8 +31,36 @@ class ForumPost
|
||||
}
|
||||
|
||||
/**
|
||||
* @var datetime $createdAt
|
||||
* @ORM\Column(type="datetime", name="created_at", nullable=false)
|
||||
* @ORM\ManyToOne(targetEntity="\KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
private $createdBy;
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param \KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return \KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime $createdAt
|
||||
* @ORM\Column(type="datetime", name="created_at")
|
||||
*/
|
||||
private $createdAt;
|
||||
|
||||
@@ -45,16 +70,15 @@ class ForumPost
|
||||
* @param DateTime $createdAt
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setCreatedAt($createdAt)
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
@@ -62,151 +86,7 @@ class ForumPost
|
||||
}
|
||||
|
||||
/**
|
||||
* @var User $createdBy
|
||||
* @ORM\ManyToOne(targetEntity="User", inversedBy="forumPosts")
|
||||
* @ORM\JoinColumn(name="created_by_id", referencedColumnName="id")
|
||||
*/
|
||||
private $createdBy;
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param User $createdBy
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setCreatedBy(User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var datetime $updatedAt
|
||||
* @ORM\Column(type="datetime", name="updated_at", nullable=true)
|
||||
*/
|
||||
private $updatedAt;
|
||||
|
||||
/**
|
||||
* Set updatedAt
|
||||
*
|
||||
* @param DateTime $updatedAt
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setUpdatedAt(\DateTime $updatedAt = null)
|
||||
{
|
||||
$this->updatedAt = $updatedAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updatedAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getUpdatedAt()
|
||||
{
|
||||
return $this->updatedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var User $updatedBy
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="updated_by_id", referencedColumnName="id")
|
||||
*/
|
||||
private $updatedBy;
|
||||
|
||||
/**
|
||||
* Set updatedBy
|
||||
*
|
||||
* @param User $updatedBy
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setUpdatedBy(User $updatedBy = null)
|
||||
{
|
||||
$this->updatedBy = $updatedBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updatedBy
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function getUpdatedBy()
|
||||
{
|
||||
return $this->updatedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $updateReason
|
||||
* @ORM\Column(type="text", name="update_reason", nullable=true)
|
||||
*/
|
||||
private $updateReason;
|
||||
|
||||
/**
|
||||
* Set updateReason
|
||||
*
|
||||
* @param string $updateReason
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setUpdateReason($updateReason = null)
|
||||
{
|
||||
$this->updateReason = $updateReason;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updateReason
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUpdateReason()
|
||||
{
|
||||
return $this->updateReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var ForumTopic $topic
|
||||
* @ORM\ManyToOne(targetEntity="ForumTopic", inversedBy="posts")
|
||||
*/
|
||||
private $topic;
|
||||
|
||||
/**
|
||||
* Set topic
|
||||
*
|
||||
* @param ForumTopic $topic
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function setTopic(ForumTopic $topic)
|
||||
{
|
||||
$this->topic = $topic;
|
||||
if (($this->topic->getLastPost() === null) || ($this->topic->getLastPost()->getCreatedAt() > $this->createdAt))
|
||||
$topic->setLastPost($this);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get topic
|
||||
*
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function getTopic()
|
||||
{
|
||||
return $this->topic;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var text $text
|
||||
* @var string $text
|
||||
* @ORM\Column(type="text", nullable=false)
|
||||
*/
|
||||
private $text;
|
||||
@@ -226,10 +106,39 @@ class ForumPost
|
||||
/**
|
||||
* Get text
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get topic
|
||||
*
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function getTopic()
|
||||
{
|
||||
return $this->topic;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -3,21 +3,19 @@
|
||||
namespace KekRozsak\FrontBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
use KekRozsak\FrontBundle\Entity\User;
|
||||
use KekRozsak\FrontBundle\Entity\ForumTopicGroup;
|
||||
use KekRozsak\FrontBundle\Entity\ForumPost;
|
||||
use KekRozsak\SecurityBundle\Entity\User;
|
||||
|
||||
/**
|
||||
* 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"})})
|
||||
* @ORM\Table(name="forum_topics")
|
||||
*/
|
||||
class ForumTopic
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->posts = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->posts = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,72 +29,46 @@ class ForumTopic
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $title
|
||||
* @ORM\Column(type="string", length=100)
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
private $title;
|
||||
private $createdBy;
|
||||
|
||||
/**
|
||||
* Set title
|
||||
* Set createdBy
|
||||
*
|
||||
* @param string $title
|
||||
* @param KekRozsak\SecurityBundle\Entity\User
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setTitle($title)
|
||||
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
|
||||
{
|
||||
$this->title = $title;
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title
|
||||
* Get createdBy
|
||||
*
|
||||
* @return string
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getTitle()
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->title;
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $slug
|
||||
* @ORM\Column(type="string", length=100)
|
||||
*/
|
||||
private $slug;
|
||||
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->slug = $slug;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var datetime $createdAt
|
||||
* @ORM\Column(type="datetime", name="created_at")
|
||||
* @var DateTime $createdAt
|
||||
* @ORM\Column(type="datetime", nullable=false, name="created_at")
|
||||
*/
|
||||
private $createdAt;
|
||||
|
||||
@@ -106,7 +78,7 @@ class ForumTopic
|
||||
* @param DateTime $createdAt
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setCreatedAt($createdAt)
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
@@ -115,7 +87,7 @@ class ForumTopic
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
@@ -123,123 +95,9 @@ class ForumTopic
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setUpdatedAt(\DateTime $updatedAt = null)
|
||||
{
|
||||
$this->updatedAt = $updatedAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updatedAt
|
||||
*
|
||||
* @return datetime
|
||||
*/
|
||||
public function getUpdatedAt()
|
||||
{
|
||||
return $this->updatedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setUpdateReason($updateReason)
|
||||
{
|
||||
$this->updateReason = $updateReason;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updateReason
|
||||
*
|
||||
* @return text
|
||||
*/
|
||||
public function getUpdateReason()
|
||||
{
|
||||
return $this->updateReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var ForumTopicGroup
|
||||
* @ORM\ManyToOne(targetEntity="ForumTopicGroup")
|
||||
* @ORM\JoinColumn(name="topic_group_id", referencedColumnName="id")
|
||||
* @var ForumTopicGroup $topicGroup
|
||||
* @ORM\ManyToOne(targetEntity="ForumTopicGroup", inversedBy="topics")
|
||||
* @ORM\JoinColumn(name="topic_group_id")
|
||||
*/
|
||||
private $topicGroup;
|
||||
|
||||
@@ -258,44 +116,73 @@ class ForumTopic
|
||||
/**
|
||||
* Get topicGroup
|
||||
*
|
||||
* @return ForumTopicGroup
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function getTopicGroup()
|
||||
{
|
||||
return $this->topicGroup;
|
||||
}
|
||||
/**
|
||||
* @var \Doctrine\Common\Collections\ArrayCollection
|
||||
* @ORM\OneToMany(targetEntity="ForumPost", mappedBy="topic")
|
||||
*/
|
||||
private $posts;
|
||||
|
||||
/**
|
||||
* Add posts
|
||||
* @var string $slug
|
||||
* @ORM\Column(type="string", length=100, nullable=false)
|
||||
*/
|
||||
private $slug;
|
||||
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param ForumPost $posts
|
||||
* @param string $slug
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function addForumPost(ForumPost $posts)
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->posts[] = $posts;
|
||||
$this->slug = $slug;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get posts
|
||||
* Get slug
|
||||
*
|
||||
* @return Doctrine\Common\Collections\Collection
|
||||
* @return string
|
||||
*/
|
||||
public function getPosts()
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->posts;
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var ForumPost
|
||||
* @var string $title
|
||||
* @ORM\Column(type="string", length=100, nullable=false)
|
||||
*/
|
||||
private $title;
|
||||
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var ForumPost $lastPost
|
||||
* @ORM\OneToOne(targetEntity="ForumPost", cascade={"persist"})
|
||||
* @ORM\JoinColumn(name="last_post_id", referencedColumnName="id")
|
||||
* @ORM\JoinColumn(name="last_post_id")
|
||||
*/
|
||||
private $lastPost;
|
||||
|
||||
@@ -305,20 +192,47 @@ class ForumTopic
|
||||
* @param ForumPost $lastPost
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function setLastPost(ForumPost $lastPost = null)
|
||||
public function setLastPost($lastPost = null)
|
||||
{
|
||||
$this->lastPost = $lastPost;
|
||||
$this->topicGroup->setLastPost($lastPost);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lastPost
|
||||
*
|
||||
* @return ForumPost
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function getLastPost()
|
||||
{
|
||||
return $this->lastPost;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var ArrayCollection $topics;
|
||||
* @ORM\OneToMany(targetEntity="ForumPost", mappedBy="topic")
|
||||
*/
|
||||
private $posts;
|
||||
|
||||
/**
|
||||
* Add post
|
||||
*
|
||||
* @param ForumPost $post
|
||||
* @return ForumTopic
|
||||
*/
|
||||
public function addPost(ForumPost $post)
|
||||
{
|
||||
$this->posts[] = $post;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get posts
|
||||
*
|
||||
* @return ArrayCollection
|
||||
*/
|
||||
public function getPosts()
|
||||
{
|
||||
return $this->posts;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -3,10 +3,9 @@
|
||||
namespace KekRozsak\FrontBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
use KekRozsak\FrontBundle\Entity\User;
|
||||
use KekRozsak\FrontBundle\Entity\ForumTopic;
|
||||
use KekRozsak\FrontBundle\Entity\ForumPost;
|
||||
use KekRozsak\SecurityBundle\Entity\User;
|
||||
|
||||
/**
|
||||
* KekRozsak\FrontBundle\Entity\ForumTopicGroup
|
||||
@@ -17,7 +16,7 @@ class ForumTopicGroup
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->topic = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->topics = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,7 +30,7 @@ class ForumTopicGroup
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
@@ -39,64 +38,37 @@ class ForumTopicGroup
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $title
|
||||
* @ORM\Column(type="string", length=100, unique=true)
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
private $title;
|
||||
private $createdBy;
|
||||
|
||||
/**
|
||||
* Set title
|
||||
* Set createdBy
|
||||
*
|
||||
* @param string $title
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setTitle($title)
|
||||
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
|
||||
{
|
||||
$this->title = $title;
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title
|
||||
* Get createdBy
|
||||
*
|
||||
* @return string
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getTitle()
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->title;
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $slug
|
||||
* @ORM\Column(type="string", length=100, unique=true)
|
||||
*/
|
||||
private $slug;
|
||||
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->slug = $slug;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var datetime $createdAt
|
||||
* @ORM\Column(type="datetime", name="created_at")
|
||||
* @var DateTime $createdAt
|
||||
* @ORM\Column(type="datetime", nullable=false)
|
||||
*/
|
||||
private $createdAt;
|
||||
|
||||
@@ -115,7 +87,7 @@ class ForumTopicGroup
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
@@ -123,161 +95,87 @@ class ForumTopicGroup
|
||||
}
|
||||
|
||||
/**
|
||||
* @var User
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
* @var string $slug
|
||||
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
|
||||
*/
|
||||
private $createdBy;
|
||||
private $slug;
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
* Set slug
|
||||
*
|
||||
* @param User $createdBy
|
||||
* @param string $slug
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setCreatedBy(User $createdBy)
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
$this->slug = $slug;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdBy
|
||||
* Get slug
|
||||
*
|
||||
* @return User
|
||||
* @return string
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->createdBy;
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var datetime $updatedAt
|
||||
* @ORM\Column(type="datetime", name="updated_at", nullable=true)
|
||||
* @var string $title
|
||||
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
|
||||
*/
|
||||
private $updatedAt;
|
||||
private $title;
|
||||
|
||||
/**
|
||||
* Set updatedAt
|
||||
* Set title
|
||||
*
|
||||
* @param DateTime $updatedAt
|
||||
* @param string $title
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setUpdatedAt(\DateTime $updatedAt = null)
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->updatedAt = $updatedAt;
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updatedAt
|
||||
* Get title
|
||||
*
|
||||
* @return datetime
|
||||
* @return string
|
||||
*/
|
||||
public function getUpdatedAt()
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->updatedAt;
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var User
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="updated_by_id")
|
||||
*/
|
||||
private $updatedBy;
|
||||
|
||||
/**
|
||||
* Set updatedBy
|
||||
*
|
||||
* @param User $updatedBy
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setUpdatedBy(User $updatedBy = null)
|
||||
{
|
||||
$this->updatedBy = $updatedBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public function getUpdateReason()
|
||||
{
|
||||
return $this->updateReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var ForumPost
|
||||
* @ORM\OneToOne(targetEntity="ForumPost", cascade={"persist"})
|
||||
* @ORM\JoinColumn(name="last_post_id")
|
||||
*/
|
||||
private $lastPost;
|
||||
|
||||
/**
|
||||
* Set lastPost
|
||||
*
|
||||
* @param ForumPost $lastPost
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function setLastPost(ForumPost $lastPost = null)
|
||||
{
|
||||
$this->lastPost = $lastPost;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lastPost
|
||||
*
|
||||
* @return ForumPost
|
||||
*/
|
||||
public function getLastPost()
|
||||
{
|
||||
return $this->lastPost;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var \Doctrine\Common\Collections\ArrayCollection
|
||||
* @var ArrayCollection $topics
|
||||
* @ORM\OneToMany(targetEntity="ForumTopic", mappedBy="topicGroup")
|
||||
*/
|
||||
private $topics;
|
||||
|
||||
/**
|
||||
* Add topic
|
||||
*
|
||||
* @param ForumTopic $topic
|
||||
* @return ForumTopicGroup
|
||||
*/
|
||||
public function addTopic(ForumTopic $topic)
|
||||
{
|
||||
$this->topics[] = $topic;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get topics
|
||||
*
|
||||
* @return Doctrine\Common\Collections\Collection
|
||||
* @return ArrayCollection
|
||||
*/
|
||||
public function getTopics()
|
||||
{
|
||||
return $this->topics;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -5,7 +5,6 @@ namespace KekRozsak\FrontBundle\Entity;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* KekRozsak\FrontBundle\Entity\News
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="news")
|
||||
*/
|
||||
@@ -15,136 +14,26 @@ class News
|
||||
* @var integer $id
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer", name="id")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var datetime $createdAt
|
||||
* @ORM\Column(type="datetime", name="created_at")
|
||||
*/
|
||||
private $createdAt;
|
||||
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param datetime $createdAt
|
||||
* @return News
|
||||
*/
|
||||
public function setCreatedAt($createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return datetime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->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 string $title
|
||||
* @ORM\Column(type="string", length=100, nullable=false)
|
||||
* @ORM\Column(type="string", length=100)
|
||||
*/
|
||||
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
|
||||
* @return News
|
||||
*/
|
||||
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 News
|
||||
*/
|
||||
public function setUpdateReason($updateReason)
|
||||
{
|
||||
$this->updateReason = $updateReason;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updateReason
|
||||
*
|
||||
* @return text
|
||||
*/
|
||||
public function getUpdateReason()
|
||||
{
|
||||
return $this->updateReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
@@ -160,7 +49,7 @@ class News
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
@@ -168,31 +57,15 @@ class News
|
||||
}
|
||||
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @return News
|
||||
* @var string $text
|
||||
* @ORM\Column(type="text", nullable=false)
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->slug = $slug;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
private $text;
|
||||
|
||||
/**
|
||||
* Set text
|
||||
*
|
||||
* @param text $text
|
||||
* @param string $text
|
||||
* @return News
|
||||
*/
|
||||
public function setText($text)
|
||||
@@ -204,7 +77,7 @@ class News
|
||||
/**
|
||||
* Get text
|
||||
*
|
||||
* @return text
|
||||
* @return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
@@ -212,12 +85,47 @@ class News
|
||||
}
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
* @var DateTime $createdAt
|
||||
* @ORM\Column(type="datetime", name="created_at", nullable=false)
|
||||
*/
|
||||
private $createdAt;
|
||||
|
||||
/**
|
||||
* Set createdAt
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\User $createdBy
|
||||
* @param DateTime $createdAt
|
||||
* @return News
|
||||
*/
|
||||
public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy = null)
|
||||
public function setCreatedAt(\DateTime $createdAt)
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get createdAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getCreatedAt()
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var \KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @ORM\ManyToOne(targetEntity="\KekRozsak\SecurityBundle\Entity\User")
|
||||
* @ORM\JoinColumn(name="created_by_id")
|
||||
*/
|
||||
private $createdBy;
|
||||
|
||||
/**
|
||||
* Set createdBy
|
||||
*
|
||||
* @param \KekRozsak\SecurityBundle\Entity\User $createdBy
|
||||
* @return News
|
||||
*/
|
||||
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
return $this;
|
||||
@@ -226,32 +134,10 @@ class News
|
||||
/**
|
||||
* Get createdBy
|
||||
*
|
||||
* @return KekRozsak\FrontBundle\Entity\User
|
||||
* @return \KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set updatedBy
|
||||
*
|
||||
* @param KekRozsak\FrontBundle\Entity\User $updatedBy
|
||||
* @return News
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@@ -1,488 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace KekRozsak\FrontBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
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
|
||||
* @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
|
||||
{
|
||||
/**
|
||||
* @var integer $id
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $username
|
||||
* @ORM\Column(type="string", length=50, nullable=false, unique=true)
|
||||
* @Assert\NotBlank(groups={"registration"})
|
||||
*/
|
||||
private $username;
|
||||
|
||||
/**
|
||||
* Set username
|
||||
*
|
||||
* @param string $username
|
||||
* @return User
|
||||
*/
|
||||
public function setUsername($username)
|
||||
{
|
||||
$this->username = $username;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get username
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUsername()
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $password
|
||||
* @ORM\Column(type="string", length=50, nullable=false)
|
||||
* @Assert\NotBlank(groups={"registration"})
|
||||
*/
|
||||
private $password;
|
||||
|
||||
/**
|
||||
* Set password
|
||||
*
|
||||
* @param string $password
|
||||
* @return User
|
||||
*/
|
||||
public function setPassword($password)
|
||||
{
|
||||
$this->password = $password;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get password
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPassword()
|
||||
{
|
||||
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
|
||||
*
|
||||
* @param string $email
|
||||
* @return User
|
||||
*/
|
||||
public function setEmail($email)
|
||||
{
|
||||
$this->email = $email;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get email
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @return User
|
||||
*/
|
||||
public function setRegisteredAt(\DateTime $registeredAt)
|
||||
{
|
||||
$this->registeredAt = $registeredAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get registeredAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getRegisteredAt()
|
||||
{
|
||||
return $this->registeredAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $displayName
|
||||
* @ORM\Column(type="string", length=50, nullable=false, unique=true, name="display_name")
|
||||
*/
|
||||
private $displayName;
|
||||
|
||||
/**
|
||||
* Set displayName
|
||||
*
|
||||
* @param string $displayName
|
||||
* @return User
|
||||
*/
|
||||
public function setDisplayName($displayName)
|
||||
{
|
||||
$this->displayName = $displayName;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get displayName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDisplayName()
|
||||
{
|
||||
return $this->displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var User $acceptedBy
|
||||
* @ORM\ManyToOne(targetEntity="User", fetch="EXTRA_LAZY")
|
||||
* @ORM\JoinColumn(name="accepted_by_id", referencedColumnName="id")
|
||||
*/
|
||||
private $acceptedBy;
|
||||
|
||||
/**
|
||||
* Set acceptedBy
|
||||
*
|
||||
* @param User $acceptedBy
|
||||
* @return User
|
||||
*/
|
||||
public function setAcceptedBy(User $acceptedBy = null)
|
||||
{
|
||||
$this->acceptedBy = $acceptedBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get acceptedBy
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function getAcceptedBy()
|
||||
{
|
||||
return $this->acceptedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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)
|
||||
{
|
||||
$this->lastLoginAt = $lastLoginAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lastLoginAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getLastLoginAt()
|
||||
{
|
||||
return $this->lastLoginAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var \Doctrine\Common\Collections\ArrayCollection
|
||||
* @ORM\OneToMany(targetEntity="Article", mappedBy="createdBy", fetch="EXTRA_LAZY")
|
||||
*/
|
||||
private $articles;
|
||||
|
||||
/**
|
||||
* Add articles
|
||||
*
|
||||
* @param Article $articles
|
||||
* @return User
|
||||
*/
|
||||
public function addArticle(Article $articles)
|
||||
{
|
||||
$this->articles[] = $articles;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get articles
|
||||
*
|
||||
* @return Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getArticles()
|
||||
{
|
||||
return $this->articles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var \Doctrine\Common\Collections\ArrayCollection
|
||||
* @ORM\OneToMany(targetEntity="ForumPost", mappedBy="createdBy", fetch="EXTRA_LAZY")
|
||||
*/
|
||||
private $forumPosts;
|
||||
|
||||
/**
|
||||
* Add forumPosts
|
||||
*
|
||||
* @param ForumPost $forumPosts
|
||||
* @return User
|
||||
*/
|
||||
public function addForumPost(ForumPost $forumPosts)
|
||||
{
|
||||
$this->forumPosts[] = $forumPosts;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get forumPosts
|
||||
*
|
||||
* @return Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getForumPosts()
|
||||
{
|
||||
return $this->forumPosts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var \Doctrine\Common\Collections\ArrayCollection $ledGroups
|
||||
* @ORM\OneToMany(targetEntity="Group", mappedBy="leader", fetch="EXTRA_LAZY")
|
||||
*/
|
||||
private $ledGroups;
|
||||
|
||||
/**
|
||||
* Add ledGroups
|
||||
*
|
||||
* @param Group $group
|
||||
* @return User
|
||||
*/
|
||||
public function addGroup(Group $group)
|
||||
{
|
||||
$this->ledGroups[] = $group;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ledGroups
|
||||
*
|
||||
* @return Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getLedGroups()
|
||||
{
|
||||
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()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* AdvancedUserInterface::isAccountNonLocked()
|
||||
*/
|
||||
public function isAccountNonLocked()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* AdvancedUserInterface::isCredentialsNonExpired()
|
||||
*/
|
||||
public function isCredentialsNonExpired()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* AdvancedUserInterface::isEnabled()
|
||||
*/
|
||||
public function isEnabled()
|
||||
{
|
||||
return ($this->acceptedBy !== null);
|
||||
}
|
||||
}
|
@@ -4,7 +4,7 @@ namespace KekRozsak\FrontBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
use KekRozsak\FrontBundle\Entity\User;
|
||||
use \KekRozsak\SecurityBundle\Entity\User;
|
||||
|
||||
/**
|
||||
* KekRozsak\FrontBundle\Entity\UserData
|
||||
@@ -13,31 +13,40 @@ use KekRozsak\FrontBundle\Entity\User;
|
||||
*/
|
||||
class UserData
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->emailPublic = false;
|
||||
$this->realNamePublic = false;
|
||||
$this->msnAddressPublic = false;
|
||||
$this->googleTalkPublic = false;
|
||||
$this->skypePublic = false;
|
||||
$this->phoneNumberPublic = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var User $user
|
||||
* @var KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @ORM\Id
|
||||
* @ORM\OneToOne(targetEntity="User", inversedBy="userData")
|
||||
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
||||
* @ORM\OneToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User", inversedBy="userData")
|
||||
* @ORM\JoinColumn(name="user_id")
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
* Set user
|
||||
*
|
||||
* @param User $user
|
||||
* @param KekRozsak\SecurityBundle\Entity\User $user
|
||||
* @return UserData
|
||||
*/
|
||||
public function setUser(User $user = null)
|
||||
public function setUser(\KekRozsak\SecurityBundle\Entity\User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->userId = $user->getId();
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user
|
||||
*
|
||||
* @return User
|
||||
* @return KekRozsak\SecurityBundle\Entity\User
|
||||
*/
|
||||
public function getUser()
|
||||
{
|
||||
@@ -65,7 +74,7 @@ class UserData
|
||||
/**
|
||||
* Get emailPublic
|
||||
*
|
||||
* @return boolean
|
||||
* @return boolean
|
||||
*/
|
||||
public function getEmailPublic()
|
||||
{
|
||||
@@ -74,7 +83,7 @@ class UserData
|
||||
|
||||
/**
|
||||
* @var string $realName
|
||||
* @ORM\Column(name="real_name", type="string", length=100, nullable=true)
|
||||
* @ORM\Column(type="string", length=100, nullable=true, name="real_name")
|
||||
*/
|
||||
protected $realName;
|
||||
|
||||
@@ -84,7 +93,7 @@ class UserData
|
||||
* @param string $realName
|
||||
* @return UserData
|
||||
*/
|
||||
public function setRealName($realName)
|
||||
public function setRealName($realName = null)
|
||||
{
|
||||
$this->realName = $realName;
|
||||
return $this;
|
||||
@@ -93,7 +102,7 @@ class UserData
|
||||
/**
|
||||
* Get realName
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
public function getRealName()
|
||||
{
|
||||
@@ -102,7 +111,7 @@ class UserData
|
||||
|
||||
/**
|
||||
* @var boolean $realNamePublic
|
||||
* @ORM\Column(name="real_name_public", type="boolean", nullable=false)
|
||||
* @ORM\Column(type="boolean", name="real_name_public")
|
||||
*/
|
||||
protected $realNamePublic;
|
||||
|
||||
@@ -112,7 +121,7 @@ class UserData
|
||||
* @param boolean $realNamePublic
|
||||
* @return UserData
|
||||
*/
|
||||
public function setRealNamePublic($realNamePublic)
|
||||
public function setRealNamePublic($realNamePublic = false)
|
||||
{
|
||||
$this->realNamePublic = $realNamePublic;
|
||||
return $this;
|
||||
@@ -121,7 +130,7 @@ class UserData
|
||||
/**
|
||||
* Get realNamePublic
|
||||
*
|
||||
* @return boolean
|
||||
* @return boolean
|
||||
*/
|
||||
public function getRealNamePublic()
|
||||
{
|
||||
@@ -129,18 +138,18 @@ class UserData
|
||||
}
|
||||
|
||||
/**
|
||||
* @var text $selfDescription
|
||||
* @ORM\Column(name="self_description", type="text", nullable=true)
|
||||
* @var string $selfDescription
|
||||
* @ORM\Column(type="text", nullable=true, name="self_description")
|
||||
*/
|
||||
protected $selfDescription;
|
||||
|
||||
/**
|
||||
* Set selfDescription
|
||||
*
|
||||
* @param text $selfDescription
|
||||
* @param string $selfDescription
|
||||
* @return UserData
|
||||
*/
|
||||
public function setSelfDescription($selfDescription)
|
||||
public function setSelfDescription($selfDescription = null)
|
||||
{
|
||||
$this->selfDescription = $selfDescription;
|
||||
return $this;
|
||||
@@ -149,7 +158,7 @@ class UserData
|
||||
/**
|
||||
* Get selfDescription
|
||||
*
|
||||
* @return text
|
||||
* @return string
|
||||
*/
|
||||
public function getSelfDescription()
|
||||
{
|
||||
@@ -158,7 +167,7 @@ class UserData
|
||||
|
||||
/**
|
||||
* @var string $msnAddress
|
||||
* @ORM\Column(type="string", length=100, name="msn_address", nullable=true)
|
||||
* @ORM\Column(type="string", length=100, nullable=true, name="msn_address")
|
||||
*/
|
||||
protected $msnAddress;
|
||||
|
||||
@@ -168,7 +177,7 @@ class UserData
|
||||
* @param string $msnAddress
|
||||
* @return UserData
|
||||
*/
|
||||
public function setMsnAddress($msnAddress)
|
||||
public function setMsnAddress($msnAddress = null)
|
||||
{
|
||||
$this->msnAddress = $msnAddress;
|
||||
return $this;
|
||||
@@ -177,7 +186,7 @@ class UserData
|
||||
/**
|
||||
* Get msnAddress
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
public function getMsnAddress()
|
||||
{
|
||||
@@ -186,7 +195,7 @@ class UserData
|
||||
|
||||
/**
|
||||
* @var boolean $msnAddressPublic
|
||||
* @ORM\Column(type="boolean", name="msn_address_public", nullable=false)
|
||||
* @ORM\Column(type="boolean", name="msn_address_public")
|
||||
*/
|
||||
protected $msnAddressPublic;
|
||||
|
||||
@@ -205,7 +214,7 @@ class UserData
|
||||
/**
|
||||
* Get msnAddressPublic
|
||||
*
|
||||
* @return boolean
|
||||
* @return boolean
|
||||
*/
|
||||
public function getMsnAddressPublic()
|
||||
{
|
||||
@@ -214,7 +223,7 @@ class UserData
|
||||
|
||||
/**
|
||||
* @var string $googleTalk
|
||||
* @ORM\Column(type="string", length=100, name="google_talk", nullable=true)
|
||||
* @ORM\Column(type="string", length=100, nullable=true, name="google_talk")
|
||||
*/
|
||||
protected $googleTalk;
|
||||
|
||||
@@ -224,7 +233,7 @@ class UserData
|
||||
* @param string $googleTalk
|
||||
* @return UserData
|
||||
*/
|
||||
public function setGoogleTalk($googleTalk)
|
||||
public function setGoogleTalk($googleTalk = null)
|
||||
{
|
||||
$this->googleTalk = $googleTalk;
|
||||
return $this;
|
||||
@@ -242,7 +251,7 @@ class UserData
|
||||
|
||||
/**
|
||||
* @var boolean $googleTalkPublic
|
||||
* @ORM\Column(type="boolean", name="google_talk_public", nullable=false)
|
||||
* @ORM\Column(type="boolean", name="google_talk_public")
|
||||
*/
|
||||
protected $googleTalkPublic;
|
||||
|
||||
@@ -261,7 +270,7 @@ class UserData
|
||||
/**
|
||||
* Get googleTalkPublic
|
||||
*
|
||||
* @return boolean
|
||||
* @return boolean
|
||||
*/
|
||||
public function getGoogleTalkPublic()
|
||||
{
|
||||
@@ -270,7 +279,7 @@ class UserData
|
||||
|
||||
/**
|
||||
* @var string $skype
|
||||
* @ORM\Column(type="string", length=100, nullable=true)
|
||||
* @ORM\Column(type="string", length=100, nullable=true, name="skype")
|
||||
*/
|
||||
protected $skype;
|
||||
|
||||
@@ -280,7 +289,7 @@ class UserData
|
||||
* @param string $skype
|
||||
* @return UserData
|
||||
*/
|
||||
public function setSkype($skype)
|
||||
public function setSkype($skype = null)
|
||||
{
|
||||
$this->skype = $skype;
|
||||
return $this;
|
||||
@@ -289,7 +298,7 @@ class UserData
|
||||
/**
|
||||
* Get skype
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
public function getSkype()
|
||||
{
|
||||
@@ -298,7 +307,7 @@ class UserData
|
||||
|
||||
/**
|
||||
* @var boolean $skypePublic
|
||||
* @ORM\Column(type="boolean", name="skype_public", nullable=false)
|
||||
* @ORM\Column(type="boolean", name="skype_public")
|
||||
*/
|
||||
protected $skypePublic;
|
||||
|
||||
@@ -317,7 +326,7 @@ class UserData
|
||||
/**
|
||||
* Get skypePublic
|
||||
*
|
||||
* @return boolean
|
||||
* @return boolean
|
||||
*/
|
||||
public function getSkypePublic()
|
||||
{
|
||||
@@ -326,7 +335,7 @@ class UserData
|
||||
|
||||
/**
|
||||
* @var string $phoneNumber
|
||||
* @ORM\Column(type="string", length=30, name="phone_number", nullable=true)
|
||||
* @ORM\Column(type="string", length=30, nullable=true, name="phone_number")
|
||||
*/
|
||||
protected $phoneNumber;
|
||||
|
||||
@@ -345,7 +354,7 @@ class UserData
|
||||
/**
|
||||
* Get phoneNumber
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
public function getPhoneNumber()
|
||||
{
|
||||
@@ -354,7 +363,7 @@ class UserData
|
||||
|
||||
/**
|
||||
* @var boolean $phoneNumberPublic
|
||||
* @ORM\Column(type="boolean", name="phone_number_public", nullable=false)
|
||||
* @ORM\Column(type="boolean", name="phone_number_public")
|
||||
*/
|
||||
protected $phoneNumberPublic;
|
||||
|
||||
@@ -373,7 +382,7 @@ class UserData
|
||||
/**
|
||||
* Get phoneNumberPublic
|
||||
*
|
||||
* @return boolean
|
||||
* @return boolean
|
||||
*/
|
||||
public function getPhoneNumberPublic()
|
||||
{
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<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">
|
||||
<service id="bb.twig.extension" class="KekRozsak\FrontBundle\Twig\TwigBBExtension">
|
||||
<argument type="service" id="service_container" />
|
||||
<tag name="twig.extension" />
|
||||
</service>
|
||||
|
@@ -1,15 +1,16 @@
|
||||
<?php
|
||||
namespace KekRozsak\FrontBundle\Extension;
|
||||
namespace KekRozsak\FrontBundle\Twig;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
class TwigBBExtension extends \Twig_Extension
|
||||
{
|
||||
private $container;
|
||||
private $assets;
|
||||
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
$this->assets = $container->get('templating.helper.assets');
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
public function getFilters()
|
||||
@@ -44,7 +45,7 @@ class TwigBBExtension extends \Twig_Extension
|
||||
else
|
||||
{
|
||||
// TODO: Thumbnailing!
|
||||
$sentence = substr_replace($sentence, '<img src="' . $this->assets->getUrl('upload/images/' . (($ns == '') ? '' : $ns . '/') . $name) . '" alt="" />', $start, $len);
|
||||
$sentence = substr_replace($sentence, '<img src="' . $this->container->get('templating.helper.assets')->getUrl('upload/images/' . (($ns == '') ? '' : $ns . '/') . $name) . '" alt="" />', $start, $len);
|
||||
}
|
||||
}
|
||||
while (preg_match('/\\[link( (url)="[^"]+"){1,}\\](?P<content>.*?)\\[\\/link\\]/i', $sentence, $m, PREG_OFFSET_CAPTURE))
|
@@ -3,18 +3,20 @@
|
||||
namespace KekRozsak\SecurityBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Security\Core\SecurityContext;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Component\Security\Core\SecurityContext;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
use KekRozsak\FrontBundle\Entity\User;
|
||||
use KekRozsak\FrontBundle\Form\Type\UserType;
|
||||
use KekRozsak\SecurityBundle\Entity\User;
|
||||
use KekRozsak\SecurityBundle\Form\Type\UserType;
|
||||
use KekRozsak\FrontBundle\Entity\UserData;
|
||||
|
||||
class DefaultController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Route("/login", name="KekRozsakSecurityBundle_login")
|
||||
* @Template()
|
||||
*/
|
||||
public function loginAction()
|
||||
{
|
||||
@@ -31,10 +33,10 @@ class DefaultController extends Controller
|
||||
$session->remove(SecurityContext::AUTHENTICATION_ERROR);
|
||||
}
|
||||
|
||||
return $this->render('KekRozsakSecurityBundle:Default:login.html.twig', array(
|
||||
return array(
|
||||
'last_username' => $session->get(SecurityContext::LAST_USERNAME),
|
||||
'error' => $error,
|
||||
));
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,38 +50,45 @@ class DefaultController extends Controller
|
||||
/**
|
||||
* @Route("/logout", name="KekRozsakSecurityBundle_logout")
|
||||
*/
|
||||
public function logoutAction()
|
||||
{
|
||||
public function logoutAction()
|
||||
{
|
||||
// The security layer will intercept this request. This method will never be called.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/jelentkezes", name="KekRozsakSecurityBundle_registration")
|
||||
* @Template()
|
||||
*/
|
||||
public function registrationAction(Request $request)
|
||||
public function registrationAction()
|
||||
{
|
||||
$user = $this->get('security.context')->getToken()->getUser();
|
||||
if ($user instanceof UserInterface)
|
||||
{
|
||||
return $this->redirect($this->generateUrl('KekRozsakFrontBundle_homepage'));
|
||||
}
|
||||
|
||||
$user = new User();
|
||||
$form = $this->createForm(new UserType(true), $user);
|
||||
$request = $this->getRequest();
|
||||
|
||||
if ($request->getMethod() == 'POST')
|
||||
{
|
||||
$form->bindRequest($request);
|
||||
|
||||
if ($form->isValid(array('registration')))
|
||||
{
|
||||
$user->setPassword($this->get('security.encoder_factory')->getEncoder($user)->encodePassword($user->getPassword(), $user->getSalt()));
|
||||
$roleRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Role');
|
||||
$regRole = $roleRepo->findOneByName('REGISTERED');
|
||||
$user->addRole($regRole);
|
||||
$user->setRegisteredAt(new \DateTime('now'));
|
||||
$user->setPassword($this->get('security.encoder_factory')->getEncoder($user)->encodePassword($user->getPassword(), $user->getSalt()));
|
||||
$em = $this->getDoctrine()->getEntityManager();
|
||||
$em->persist($user);
|
||||
$em->flush();
|
||||
|
||||
$userData = new UserData();
|
||||
$user->setUserData($userData);
|
||||
$em->persist($user);
|
||||
$em->persist($userData);
|
||||
$em->flush();
|
||||
|
||||
$message = \Swift_Message::newInstance()
|
||||
->setSubject('Új jelentkező')
|
||||
->setFrom('info@blueroses.hu')
|
||||
@@ -91,16 +100,18 @@ class DefaultController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('KekRozsakSecurityBundle:Default:registration.html.twig', array(
|
||||
return array(
|
||||
'form' => $form->createView(),
|
||||
));
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/most-varj", name="KekRozsakSecurityBundle_reg_success")
|
||||
* @Route("/most_varj", name="KekRozsakSecurityBundle_reg_success")
|
||||
* @Template()
|
||||
*/
|
||||
public function registrationSuccessAction()
|
||||
public function regSuccessAction()
|
||||
{
|
||||
return $this->render('KekRozsakSecurityBundle:Default:registration_success.html.twig', array());
|
||||
return array(
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ class KekRozsakSecurityExtension extends Extension
|
||||
$configuration = new Configuration();
|
||||
$config = $this->processConfiguration($configuration, $configs);
|
||||
|
||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('services.yml');
|
||||
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('services.xml');
|
||||
}
|
||||
}
|
||||
|
318
src/KekRozsak/SecurityBundle/Entity/User.php
Normal file
318
src/KekRozsak/SecurityBundle/Entity/User.php
Normal file
@@ -0,0 +1,318 @@
|
||||
<?php
|
||||
|
||||
namespace KekRozsak\SecurityBundle\Entity;
|
||||
|
||||
use \Doctrine\ORM\Mapping as ORM;
|
||||
use \Symfony\Component\Security\Core\User\UserInterface;
|
||||
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\UserData;
|
||||
|
||||
/**
|
||||
* KekRozsak\SecurityBundle\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
|
||||
{
|
||||
/**
|
||||
* @var integer $id
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $username
|
||||
* @ORM\Column(type="string", length=50, nullable=false, unique=true)
|
||||
* @Assert\NotBlank(groups="registration")
|
||||
*/
|
||||
private $username;
|
||||
|
||||
/**
|
||||
* Set username
|
||||
*
|
||||
* @param string $username
|
||||
* @return User
|
||||
*/
|
||||
public function setUsername($username)
|
||||
{
|
||||
$this->username = $username;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get username
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUsername()
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $password
|
||||
* @ORM\Column(type="string", length=50, nullable=false)
|
||||
* @Assert\NotBlank(groups="registration")
|
||||
*/
|
||||
private $password;
|
||||
|
||||
/**
|
||||
* Set password
|
||||
*
|
||||
* @param string $password
|
||||
* @return User
|
||||
*/
|
||||
public function setPassword($password)
|
||||
{
|
||||
$this->password = $password;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get password
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $displayName
|
||||
* @ORM\Column(type="string", length=50, unique=true, name="display_name")
|
||||
*/
|
||||
private $displayName;
|
||||
|
||||
/**
|
||||
* Set displayName
|
||||
*
|
||||
* @param string $displayName
|
||||
* @return User
|
||||
*/
|
||||
public function setDisplayName($displayName)
|
||||
{
|
||||
$this->displayName = $displayName;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get displayName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDisplayName()
|
||||
{
|
||||
return $this->displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var string $email
|
||||
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
|
||||
*/
|
||||
private $email;
|
||||
|
||||
/**
|
||||
* Set email
|
||||
*
|
||||
* @param string $email
|
||||
* @return User
|
||||
*/
|
||||
public function setEmail($email)
|
||||
{
|
||||
$this->email = $email;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get email
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var DateTime $registeredAt
|
||||
* @ORM\Column(type="datetime", nullable=false, name="registered_at")
|
||||
*/
|
||||
private $registeredAt;
|
||||
|
||||
/**
|
||||
* Set registeredAt
|
||||
*
|
||||
* @param DateTime $registeredAt
|
||||
* @return User
|
||||
*/
|
||||
public function setRegisteredAt(\DateTime $registeredAt)
|
||||
{
|
||||
$this->registeredAt = $registeredAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get registeredAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getRegisteredAt()
|
||||
{
|
||||
return $this->registeredAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var User acceptedBy
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="accepted_by_id")
|
||||
*/
|
||||
private $acceptedBy;
|
||||
|
||||
/**
|
||||
* Set acceptedBy
|
||||
*
|
||||
* @param User $acceptedBy
|
||||
* @return User
|
||||
*/
|
||||
public function setAcceptedBy(User $acceptedBy = null)
|
||||
{
|
||||
$this->acceptedBy = $acceptedBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get acceptedBy
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function getAcceptedBy()
|
||||
{
|
||||
return $this->acceptedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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)
|
||||
{
|
||||
$this->lastLoginAt = $lastLoginAt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lastLoginAt
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getLastLoginAt()
|
||||
{
|
||||
return $this->lastLoginAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var \KekRozsak\FrontBundle\Entity\UserData $userData
|
||||
* @ORM\OneToOne(targetEntity="KekRozsak\FrontBundle\Entity\UserData", mappedBy="user", fetch="LAZY", cascade={"persist"})
|
||||
* @ORM\JoinColumn(name="id", referencedColumnName="user_id")
|
||||
*/
|
||||
private $userData;
|
||||
|
||||
|
||||
/**
|
||||
* Set userData
|
||||
*
|
||||
* @param \KekRozsak\FrontBundle\Entity\UserData $userData
|
||||
* @return User
|
||||
*/
|
||||
public function setUserData(\KekRozsak\FrontBundle\Entity\UserData $userData = null)
|
||||
{
|
||||
$this->userData = $userData;
|
||||
$userData->setUser($this);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get userData
|
||||
*
|
||||
* @return \KekRozsak\FrontBundle\Entity\UserData
|
||||
*/
|
||||
public function getUserData()
|
||||
{
|
||||
return $this->userData;
|
||||
}
|
||||
|
||||
/* Here comes the remaining part of UserInterface implementation */
|
||||
|
||||
public function getRoles()
|
||||
{
|
||||
/* As we use ACLs instead of roles, every user get the
|
||||
* ROLE_USER role, and nothing else
|
||||
*/
|
||||
return array('ROLE_USER');
|
||||
}
|
||||
|
||||
public function getSalt()
|
||||
{
|
||||
/* As we use crypt() to encode passwords, salt is always the
|
||||
* same as password
|
||||
*/
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
public function eraseCredentials()
|
||||
{
|
||||
}
|
||||
|
||||
/* Here comes the AdvancedUserInterface implementation */
|
||||
|
||||
public function isAccountNonExpired()
|
||||
{
|
||||
/* Currently, accounts never expire */
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isAccountNonLocked()
|
||||
{
|
||||
/* Currently, accounts cannot be locked */
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isCredentialsNonExpired()
|
||||
{
|
||||
/* Currently, credentials never expire */
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isEnabled()
|
||||
{
|
||||
/* Account is enabled if it is accepted by someone */
|
||||
return ($this->acceptedBy !== null);
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace KekRozsak\FrontBundle\Form\Type;
|
||||
namespace KekRozsak\SecurityBundle\Form\Type;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
@@ -64,7 +64,7 @@ class UserType extends AbstractType
|
||||
public function getDefaultOptions()
|
||||
{
|
||||
$opts = array(
|
||||
'data_class' => 'KekRozsak\FrontBundle\Entity\User',
|
||||
'data_class' => 'KekRozsak\SecurityBundle\Entity\User',
|
||||
);
|
||||
if ($this->_registration)
|
||||
$opts['validation_groups'] = array('registration');
|
11
src/KekRozsak/SecurityBundle/Resources/config/services.xml
Normal file
11
src/KekRozsak/SecurityBundle/Resources/config/services.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?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_security.encoder.crypt" class="KekRozsak\SecurityBundle\Service\CryptEncoder">
|
||||
</service>
|
||||
<service id="security.authentication.success_handler" class="KekRozsak\SecurityBundle\Security\AuthSuccess">
|
||||
<argument type="service" id="doctrine" />
|
||||
</service>
|
||||
</services>
|
||||
</container>
|
@@ -1,10 +0,0 @@
|
||||
parameters:
|
||||
|
||||
services:
|
||||
kek_rozsak_security.encoder.crypt:
|
||||
class: KekRozsak\SecurityBundle\Service\CryptEncoder
|
||||
security.authentication.success_handler:
|
||||
class: KekRozsak\SecurityBundle\Security\AuthSuccess
|
||||
public: false
|
||||
arguments:
|
||||
doctrine: @doctrine
|
@@ -5,6 +5,7 @@
|
||||
{% block title %} - Regisztráció {% endblock %}
|
||||
{% block content %}
|
||||
<h3>Jelentkezés</h3>
|
||||
<p>Amennyiben már tagja vagy a körnek, <a href="{{ path('KekRozsakSecurityBundle_login') }}">itt bejelentkezhetsz</a>.
|
||||
<p>Az alábbi űrlap kitöltésével jelentkezhetsz a Kék Rózsa okkultista kör tagjai közé. Kérünk, hogy jelentkezés előtt figyelmesen olvasd el a <a href="{{ path('KekRozsakFrontBundle_article', { articleSlug: 'rolunk' }) }}">Rólunk</a> menüpont szövegét, különös tekintettel a Házirendre.</p>
|
||||
<p>A jelentkezés NEM jár automatikus tagsággal. A Házirend szerint a Vének jogot formálhatnak arra, hogy a jelentkezésedet elutasítsák, vagy próbáknak vessenek alá, mielőtt a tagok közé fogadnak.</p>
|
||||
<p><strong>FONTOS!</strong> Aki a régi fórumon írt bármilyen bejegyzést, az már regisztrálva van ezen az oldalon is! Ez esetben kérlek lépjetek kapcsolatba velem <a href="http://www.facebook.com/Polesz" target="_blank">Facebookon</a> vagy e-mailben a <a href="jelentkezes@blueroses.hu">jelentkezes@blueroses.hu</a> címen!</p>
|
||||
|
Reference in New Issue
Block a user