diff --git a/TODO b/TODO index c7e7495..556051d 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,6 @@ -Article - public - roles who can access it +Polls (Entity already exists) +Groups (Entity already exists) +Article check if public UserForumViewed it should contain records that show the last viewed post in each forum topic @@ -35,18 +35,6 @@ ForumPost edit count text -Vote - id - creator - created at - active - text - others can add new answers - answers - id - creator - text - Library id owner @@ -58,7 +46,7 @@ Library borrower returned commentable -Program +Event id creator created at @@ -68,34 +56,15 @@ Program start time end time (may be null) description + location commentable -Document - id - creator - created at - last edited by - last edited timestamp - last edit reason - title - slug - text - group - nullable, onetomany - PrivateChatMessage id from user to user timestamp -Group - id - name - created by - creation time - leader - members - GroupChatMessage id from user diff --git a/app/config/routing.yml b/app/config/routing.yml index 81455ae..d77dd32 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml @@ -1,16 +1,15 @@ KekRozsakAdminBundle: - resource: "@KekRozsakAdminBundle/Resources/config/routing.yml" - prefix: /admin + resource: "@KekRozsakAdminBundle/Controller/DefaultController.php" + type: annotation KekRozsakSecurityBundle: - resource: "@KekRozsakSecurityBundle/Resources/config/routing.yml" - prefix: / + resource: "@KekRozsakSecurityBundle/Controller/DefaultController.php" + type: annotation -KekRozsakFrontBundle: - resource: "@KekRozsakFrontBundle/Resources/config/routing.yml" - prefix: / +KekRozsakFrontBundle_Default: + resource: "@KekRozsakFrontBundle/Controller/DefaultController.php" + type: annotation -# Internal routing configuration to handle ESI -#_internal: -# resource: "@FrameworkBundle/Resources/config/routing/internal.xml" -# prefix: /_internal +KekRozsakFrontBundle_Forum: + resource: "@KekRozsakFrontBundle/Controller/ForumController.php" + type: annotation diff --git a/src/KekRozsak/AdminBundle/Controller/DefaultController.php b/src/KekRozsak/AdminBundle/Controller/DefaultController.php index f75b1eb..31fccad 100644 --- a/src/KekRozsak/AdminBundle/Controller/DefaultController.php +++ b/src/KekRozsak/AdminBundle/Controller/DefaultController.php @@ -2,12 +2,23 @@ namespace KekRozsak\AdminBundle\Controller; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; +/** + * @Route("/admin") + */ class DefaultController extends Controller { - public function manageRegsAction($name) - { - return $this->render('KekRozsakAdminBundle:Default:manage_regs.html.twig'); - } + /** + * @Route("/jelentkezok", name="KekRozsakAdminBundle_manage_reg") + */ + public function manageRegsAction() + { + $users = $this->getDoctrine()->getEntityManager()->createQuery('SELECT u FROM KekRozsakFrontBundle:User u WHERE u.acceptedBy IS NULL')->getResult(); + + return $this->render('KekRozsakAdminBundle:Default:manage_regs.html.twig', array ( + 'users' => $users, + )); + } } diff --git a/src/KekRozsak/AdminBundle/DependencyInjection/KekRozsakAdminExtension.php b/src/KekRozsak/AdminBundle/DependencyInjection/KekRozsakAdminExtension.php index 7b2feee..62362ba 100644 --- a/src/KekRozsak/AdminBundle/DependencyInjection/KekRozsakAdminExtension.php +++ b/src/KekRozsak/AdminBundle/DependencyInjection/KekRozsakAdminExtension.php @@ -22,7 +22,7 @@ class KekRozsakAdminExtension extends Extension $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); - $loader->load('services.yml'); + $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $loader->load('services.xml'); } } diff --git a/src/KekRozsak/AdminBundle/Resources/config/services.xml b/src/KekRozsak/AdminBundle/Resources/config/services.xml new file mode 100644 index 0000000..6800790 --- /dev/null +++ b/src/KekRozsak/AdminBundle/Resources/config/services.xml @@ -0,0 +1,4 @@ + + + + diff --git a/src/KekRozsak/AdminBundle/Resources/config/services.yml b/src/KekRozsak/AdminBundle/Resources/config/services.yml deleted file mode 100644 index 4f594e8..0000000 --- a/src/KekRozsak/AdminBundle/Resources/config/services.yml +++ /dev/null @@ -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%] diff --git a/src/KekRozsak/AdminBundle/Resources/views/Default/manage_regs.html.twig b/src/KekRozsak/AdminBundle/Resources/views/Default/manage_regs.html.twig index 1daf198..1204c7a 100644 --- a/src/KekRozsak/AdminBundle/Resources/views/Default/manage_regs.html.twig +++ b/src/KekRozsak/AdminBundle/Resources/views/Default/manage_regs.html.twig @@ -1 +1,32 @@ -Juj! +{% extends '::main_template.html.twig' %} +{% block title %} - Jelentkezők{% endblock %} +{% block content %} +

Jelentkezők

+{% if users|length > 0 %} + + + + + + + + + + +{% for user in users %} + + + + + + + +{% endfor %} + +
FelhasználónévE-mail címFórum-névRegisztráció ideje
{{ user.username }}{{ user.email }}{{ user.displayName }}{{ user.registeredAt|date('Y-m-d H:i') }} +
+ +
+
+{% endif %} +{%endblock content %} diff --git a/src/KekRozsak/FrontBundle/Controller/DefaultController.php b/src/KekRozsak/FrontBundle/Controller/DefaultController.php index bce66f7..1ca3fc6 100644 --- a/src/KekRozsak/FrontBundle/Controller/DefaultController.php +++ b/src/KekRozsak/FrontBundle/Controller/DefaultController.php @@ -2,21 +2,28 @@ namespace KekRozsak\FrontBundle\Controller; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use KekRozsak\FrontBundle\Form\Type\UserType; class DefaultController extends Controller { + /** + * @Route("/", name="KekRozsakFrontBundle_homepage") + */ public function homepageAction() { - $mainPageArticle = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Article')->findOneBy(array('main_page' => 1), true, array('created_at', 'DESC'), 1); + $mainPageArticle = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Article')->findOneBy(array('mainPage' => 1), true, array('createdAt', 'DESC'), 1); if (!$mainPageArticle) throw $this->createNotFoundException('A keresett cikk nem létezik!'); return $this->forward('KekRozsakFrontBundle:Default:article', array('articleSlug' => $mainPageArticle->getSlug())); } + /** + * @Route("/cikk/{articleSlug}", name="KekRozsakFrontBundle_article") + */ public function articleAction($articleSlug) { $article = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Article')->findOneBySlug($articleSlug); @@ -29,6 +36,9 @@ class DefaultController extends Controller )); } + /** + * @Route("/profil", name="KekRozsakFrontBundle_profile_edit") + */ public function profileEditAction() { $user = $this->get('security.context')->getToken()->getUser(); diff --git a/src/KekRozsak/FrontBundle/Controller/ForumController.php b/src/KekRozsak/FrontBundle/Controller/ForumController.php index 6b71f37..3b2faff 100644 --- a/src/KekRozsak/FrontBundle/Controller/ForumController.php +++ b/src/KekRozsak/FrontBundle/Controller/ForumController.php @@ -2,14 +2,21 @@ namespace KekRozsak\FrontBundle\Controller; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use KekRozsak\FrontBundle\Entity\ForumPost; use KekRozsak\FrontBundle\Form\Type\ForumPostType; +/** + * @Route("/forum") + */ class ForumController extends Controller { + /** + * @Route("", name="KekRozsakFrontBundle_forum_main") + */ public function mainAction() { // TODO: Protect this controller with roles? It is also defined in security.yml @@ -22,6 +29,9 @@ class ForumController extends Controller )); } + /** + * @Route("/{topicGroupSlug}", name="KekRozsakFrontBundle_forum_topic_list") + */ public function topicListAction($topicGroupSlug) { $groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumTopicGroup'); @@ -33,6 +43,9 @@ class ForumController extends Controller )); } + /** + * @Route("/{topicGroupSlug}/{topicSlug}", name="KekRozsakFrontBundle_forum_post_list") + */ public function postListAction($topicGroupSlug, $topicSlug) { $request = $this->getRequest(); @@ -44,12 +57,12 @@ class ForumController extends Controller // Get the topic based on slug $topicRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumTopic'); - if (!($topic = $topicRepo->findOneBy(array('topic_group' => $topicGroup, 'slug' => $topicSlug)))) + if (!($topic = $topicRepo->findOneBy(array('topicGroup' => $topicGroup, 'slug' => $topicSlug)))) throw $this->createNotFoundException('A kért téma nem létezik!'); // Get the list of posts in the requested topic $postRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumPost'); - $posts = $postRepo->findBy(array('topic' => $topic), array('created_at' => 'DESC') /* TODO: , limit, offset */); + $posts = $postRepo->findBy(array('topic' => $topic), array('createdAt' => 'DESC') /* TODO: , limit, offset */); // Create an empty post object for posting $post = new ForumPost(); diff --git a/src/KekRozsak/FrontBundle/DependencyInjection/KekRozsakFrontExtension.php b/src/KekRozsak/FrontBundle/DependencyInjection/KekRozsakFrontExtension.php index 563baf7..b11b680 100644 --- a/src/KekRozsak/FrontBundle/DependencyInjection/KekRozsakFrontExtension.php +++ b/src/KekRozsak/FrontBundle/DependencyInjection/KekRozsakFrontExtension.php @@ -22,7 +22,7 @@ class KekRozsakFrontExtension extends Extension $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); - $loader->load('services.yml'); + $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $loader->load('services.xml'); } } diff --git a/src/KekRozsak/FrontBundle/Entity/Article.php b/src/KekRozsak/FrontBundle/Entity/Article.php index 3277ef1..cbbe08c 100644 --- a/src/KekRozsak/FrontBundle/Entity/Article.php +++ b/src/KekRozsak/FrontBundle/Entity/Article.php @@ -4,294 +4,340 @@ namespace KekRozsak\FrontBundle\Entity; use Doctrine\ORM\Mapping as ORM; +use KekRozsak\FrontBundle\Entity\User; + /** * KekRozsak\FrontBundle\Entity\Article + * @ORM\Entity + * @ORM\Table(name="articles") */ class Article { - /** - * @var integer $id - */ - private $id; + /** + * @var integer $id + * @ORM\Id + * @ORM\GeneratedValue(strategy="AUTO") + * @ORM\Column(type="integer", name="id") + */ + private $id; - /** - * @var string $title - */ - private $title; + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } - /** - * @var string $slug - */ - private $slug; + /** + * @var string $title + * @ORM\Column(type="string", length=100, nullable=false) + */ + private $title; - /** - * @var text $text - */ - private $text; + /** + * Set title + * + * @param string $title + * @return Article + */ + public function setTitle($title) + { + $this->title = $title; + return $this; + } - /** - * @var string $source - */ - private $source; + /** + * Get title + * + * @return string + */ + public function getTitle() + { + return $this->title; + } - /** - * @var DateTime $created_at - */ - private $created_at; + /** + * @var string $slug + * @ORM\Column(type="string", length=100, nullable=false, unique=true) + */ + private $slug; - /** - * @var DateTime $updated_at - */ - private $updated_at; + /** + * Set slug + * + * @param string $slug + * @return Article + */ + public function setSlug($slug) + { + $this->slug = $slug; + return $this; + } - /** - * @var text $update_reason - */ - private $update_reason; + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } - /** - * @var KekRozsak\FrontBundle\Entity\User - */ - private $created_by; + /** + * @var text $text + * @ORM\Column(type="text", nullable=false) + */ + private $text; - /** - * @var KekRozsak\FrontBundle\Entity\User - */ - private $updated_by; + /** + * Set text + * + * @param text $text + * @return Article + */ + public function setText($text) + { + $this->text = $text; + return $this; + } + /** + * Get text + * + * @return text + */ + public function getText() + { + return $this->text; + } - /** - * Get id - * - * @return integer - */ - public function getId() - { - return $this->id; - } + /** + * @var string $source + * @ORM\Column(type="string", length=255, nullable=true) + */ + private $source; - /** - * Set title - * - * @param string $title - * @return Article - */ - public function setTitle($title) - { - $this->title = $title; - return $this; - } + /** + * Set source + * + * @param string $source + * @return Article + */ + public function setSource($source) + { + $this->source = $source; + return $this; + } - /** - * Get title - * - * @return string - */ - public function getTitle() - { - return $this->title; - } + /** + * Get source + * + * @return string + */ + public function getSource() + { + return $this->source; + } - /** - * Set slug - * - * @param string $slug - * @return Article - */ - public function setSlug($slug) - { - $this->slug = $slug; - return $this; - } + /** + * @var DateTime $createdAt + * @ORM\Column(type="datetime", nullable=false, name="created_at") + */ + private $createdAt; - /** - * Get slug - * - * @return string - */ - public function getSlug() - { - return $this->slug; - } + /** + * Set createdAt + * + * @param DateTime $createdAt + * @return Article + */ + public function setCreatedAt(\DateTime $createdAt) + { + $this->createdAt = $createdAt; + return $this; + } - /** - * Set text - * - * @param text $text - * @return Article - */ - public function setText($text) - { - $this->text = $text; - return $this; - } + /** + * Get createdAt + * + * @return DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } - /** - * Get text - * - * @return text - */ - public function getText() - { - return $this->text; - } + /** + * @var User $createdBy + * @ORM\ManyToOne(targetEntity="User", inversedBy="articles") + * @ORM\JoinColumn(name="created_by_id", referencedColumnName="id") + */ + private $createdBy; - /** - * Set source - * - * @param string $source - * @return Article - */ - public function setSource($source) - { - $this->source = $source; - return $this; - } + /** + * Set createdBy + * + * @param User $createdBy + * @return Article + */ + public function setCreatedBy(User $createdBy = null) + { + $this->createdBy = $createdBy; + return $this; + } - /** - * Get source - * - * @return string - */ - public function getSource() - { - return $this->source; - } + /** + * Get createdBy + * + * @return User + */ + public function getCreatedBy() + { + return $this->createdBy; + } - /** - * Set created_at - * - * @param DateTime $createdAt - * @return Article - */ - public function setCreatedAt(\DateTime $createdAt) - { - $this->created_at = $createdAt; - return $this; - } + /** + * @var DateTime $updatedAt + * @ORM\Column(type="datetime", nullable=true, name="updated_at") + */ + private $updatedAt; - /** - * Get created_at - * - * @return DateTime - */ - public function getCreatedAt() - { - return $this->created_at; - } + /** + * Set updatedAt + * + * @param DateTime $updatedAt + * @return Article + */ + public function setUpdatedAt(\DateTime $updatedAt) + { + $this->updatedAt = $updatedAt; + return $this; + } - /** - * Set updated_at - * - * @param DateTime $updatedAt - * @return Article - */ - public function setUpdatedAt(\DateTime $updatedAt) - { - $this->updated_at = $updatedAt; - return $this; - } + /** + * Get updatedAt + * + * @return DateTime + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } - /** - * Get updated_at - * - * @return DateTime - */ - public function getUpdatedAt() - { - return $this->updated_at; - } + /** + * @var User $updatedBy + * @ORM\ManyToOne(targetEntity="User") + * @ORM\JoinColumn(name="updated_by_id", referencedColumnName="id") + */ + private $updatedBy; - /** - * Set update_reason - * - * @param text $updateReason - * @return Article - */ - public function setUpdateReason($updateReason) - { - $this->update_reason = $updateReason; - return $this; - } + /** + * Set updatedBy + * + * @param User $updatedBy + * @return Article + */ + public function setUpdatedBy(User $updatedBy = null) + { + $this->updatedBy = $updatedBy; + return $this; + } - /** - * Get update_reason - * - * @return text - */ - public function getUpdateReason() - { - return $this->update_reason; - } + /** + * Get updatedBy + * + * @return User + */ + public function getUpdatedBy() + { + return $this->updatedBy; + } - /** - * Set created_by - * - * @param KekRozsak\FrontBundle\Entity\User $createdBy - * @return Article - */ - public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy = null) - { - $this->created_by = $createdBy; - return $this; - } + /** + * @var text $updateReason + * @ORM\Column(type="text", nullable=true, name="update_reason") + */ + private $updateReason; - /** - * Get created_by - * - * @return KekRozsak\FrontBundle\Entity\User - */ - public function getCreatedBy() - { - return $this->created_by; - } + /** + * Set updateReason + * + * @param text $updateReason + * @return Article + */ + public function setUpdateReason($updateReason) + { + $this->updateReason = $updateReason; + return $this; + } - /** - * 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 updateReason + * + * @return text + */ + public function getUpdateReason() + { + return $this->updateReason; + } - /** - * Get updated_by - * - * @return KekRozsak\FrontBundle\Entity\User - */ - public function getUpdatedBy() - { - return $this->updated_by; - } - /** - * @var boolean $main_page - */ - private $main_page; + /** + * @var boolean $mainPage + * @ORM\Column(type="boolean", name="main_page", nullable=true) + */ + private $mainPage; + /** + * Set mainPage + * + * @param boolean $mainPage + * @return Article + */ + public function setMainPage($mainPage) + { + $this->mainPage = $mainPage; + return $this; + } - /** - * Set main_page - * - * @param boolean $mainPage - * @return Article - */ - public function setMainPage($mainPage) - { - $this->main_page = $mainPage; - return $this; - } + /** + * Get mainPage + * + * @return boolean + */ + public function getMainPage() + { + return $this->mainPage; + } - /** - * Get main_page - * - * @return boolean - */ - public function getMainPage() - { - return $this->main_page; - } -} \ No newline at end of file + /** + * @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; + } +} diff --git a/src/KekRozsak/FrontBundle/Entity/Document.php b/src/KekRozsak/FrontBundle/Entity/Document.php new file mode 100644 index 0000000..48ef8e2 --- /dev/null +++ b/src/KekRozsak/FrontBundle/Entity/Document.php @@ -0,0 +1,286 @@ +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; + } +} + diff --git a/src/KekRozsak/FrontBundle/Entity/ForumPost.php b/src/KekRozsak/FrontBundle/Entity/ForumPost.php index 76e0f71..7817e29 100644 --- a/src/KekRozsak/FrontBundle/Entity/ForumPost.php +++ b/src/KekRozsak/FrontBundle/Entity/ForumPost.php @@ -4,217 +4,232 @@ namespace KekRozsak\FrontBundle\Entity; use Doctrine\ORM\Mapping as ORM; +use KekRozsak\FrontBundle\Entity\User; use KekRozsak\FrontBundle\Entity\ForumTopic; use KekRozsak\FrontBundle\Entity\ForumTopicGroup; /** * KekRozsak\FrontBundle\Entity\ForumPost + * @ORM\Entity + * @ORM\Table(name="forum_posts") */ class ForumPost { - /** - * @var integer $id - */ - private $id; + /** + * @var integer $id + * @ORM\Id + * @ORM\GeneratedValue(strategy="AUTO") + * @ORM\Column(type="integer") + */ + private $id; - /** - * @var datetime $created_at - */ - private $created_at; + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } - /** - * @var datetime $updated_at - */ - private $updated_at; + /** + * @var datetime $createdAt + * @ORM\Column(type="datetime", name="created_at", nullable=false) + */ + private $createdAt; - /** - * @var string $update_reason - */ - private $update_reason; + /** + * Set createdAt + * + * @param DateTime $createdAt + * @return ForumPost + */ + public function setCreatedAt($createdAt) + { + $this->createdAt = $createdAt; + return $this; + } - /** - * @var text $text - */ - private $text; + /** + * Get createdAt + * + * @return DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } - /** - * @var KekRozsak\FrontBundle\Entity\User - */ - private $created_by; + /** + * @var User $createdBy + * @ORM\ManyToOne(targetEntity="User", inversedBy="forumPosts") + * @ORM\JoinColumn(name="created_by_id", referencedColumnName="id") + */ + private $createdBy; - /** - * @var KekRozsak\FrontBundle\Entity\User - */ - private $updated_by; + /** + * Set createdBy + * + * @param User $createdBy + * @return ForumPost + */ + public function setCreatedBy(User $createdBy) + { + $this->createdBy = $createdBy; + return $this; + } - /** - * @var KekRozsak\FrontBundle\Entity\ForumTopic - */ - private $topic; + /** + * Get createdBy + * + * @return User + */ + public function getCreatedBy() + { + return $this->createdBy; + } + /** + * @var datetime $updatedAt + * @ORM\Column(type="datetime", name="updated_at", nullable=true) + */ + private $updatedAt; - /** - * Get id - * - * @return integer - */ - public function getId() - { - return $this->id; - } + /** + * Set updatedAt + * + * @param DateTime $updatedAt + * @return ForumPost + */ + public function setUpdatedAt(\DateTime $updatedAt = null) + { + $this->updatedAt = $updatedAt; + return $this; + } - /** - * Set created_at - * - * @param datetime $createdAt - * @return ForumPost - */ - public function setCreatedAt($createdAt) - { - $this->created_at = $createdAt; - return $this; - } + /** + * Get updatedAt + * + * @return DateTime + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } - /** - * Get created_at - * - * @return datetime - */ - public function getCreatedAt() - { - return $this->created_at; - } + /** + * @var User $updatedBy + * @ORM\ManyToOne(targetEntity="User") + * @ORM\JoinColumn(name="updated_by_id", referencedColumnName="id") + */ + private $updatedBy; - /** - * Set updated_at - * - * @param datetime $updatedAt - * @return ForumPost - */ - public function setUpdatedAt($updatedAt) - { - $this->updated_at = $updatedAt; - return $this; - } + /** + * Set updatedBy + * + * @param User $updatedBy + * @return ForumPost + */ + public function setUpdatedBy(User $updatedBy = null) + { + $this->updatedBy = $updatedBy; + return $this; + } - /** - * Get updated_at - * - * @return datetime - */ - public function getUpdatedAt() - { - return $this->updated_at; - } + /** + * Get updatedBy + * + * @return User + */ + public function getUpdatedBy() + { + return $this->updatedBy; + } - /** - * Set update_reason - * - * @param string $updateReason - * @return ForumPost - */ - public function setUpdateReason($updateReason) - { - $this->update_reason = $updateReason; - return $this; - } + /** + * @var string $updateReason + * @ORM\Column(type="text", name="update_reason", nullable=true) + */ + private $updateReason; - /** - * Get update_reason - * - * @return string - */ - public function getUpdateReason() - { - return $this->update_reason; - } + /** + * Set updateReason + * + * @param string $updateReason + * @return ForumPost + */ + public function setUpdateReason($updateReason = null) + { + $this->updateReason = $updateReason; + return $this; + } - /** - * Set text - * - * @param text $text - * @return ForumPost - */ - public function setText($text) - { - $this->text = $text; - return $this; - } + /** + * Get updateReason + * + * @return string + */ + public function getUpdateReason() + { + return $this->updateReason; + } - /** - * Get text - * - * @return text - */ - public function getText() - { - return $this->text; - } + /** + * @var ForumTopic $topic + * @ORM\ManyToOne(targetEntity="ForumTopic", inversedBy="posts") + */ + private $topic; - /** - * 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; - } + /** + * 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 created_by - * - * @return KekRozsak\FrontBundle\Entity\User - */ - public function getCreatedBy() - { - return $this->created_by; - } + /** + * Get topic + * + * @return ForumTopic + */ + public function getTopic() + { + return $this->topic; + } - /** - * 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; - } + /** + * @var text $text + * @ORM\Column(type="text", nullable=false) + */ + private $text; - /** - * Get updated_by - * - * @return KekRozsak\FrontBundle\Entity\User - */ - public function getUpdatedBy() - { - return $this->updated_by; - } + /** + * Set text + * + * @param string $text + * @return ForumPost + */ + public function setText($text) + { + $this->text = $text; + return $this; + } - /** - * 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; - } -} \ No newline at end of file + /** + * Get text + * + * @return string + */ + public function getText() + { + return $this->text; + } +} diff --git a/src/KekRozsak/FrontBundle/Entity/ForumTopic.php b/src/KekRozsak/FrontBundle/Entity/ForumTopic.php index bfca49a..1df74df 100644 --- a/src/KekRozsak/FrontBundle/Entity/ForumTopic.php +++ b/src/KekRozsak/FrontBundle/Entity/ForumTopic.php @@ -4,305 +4,321 @@ namespace KekRozsak\FrontBundle\Entity; use Doctrine\ORM\Mapping as ORM; +use KekRozsak\FrontBundle\Entity\User; +use KekRozsak\FrontBundle\Entity\ForumTopicGroup; +use KekRozsak\FrontBundle\Entity\ForumPost; + /** * KekRozsak\FrontBundle\Entity\ForumTopic + * @ORM\Entity + * @ORM\Table(name="forum_topics", uniqueConstraints={@ORM\UniqueConstraint(columns={"topic_group_id", "title"}), @ORM\UniqueConstraint(columns={"topic_group_id", "slug"})}) */ class ForumTopic { - /** - * @var integer $id - */ - private $id; + public function __construct() + { + $this->posts = new \Doctrine\Common\Collections\ArrayCollection(); + } - /** - * @var string $title - */ - private $title; + /** + * @var integer $id + * @ORM\Id + * @ORM\GeneratedValue(strategy="AUTO") + * @ORM\Column(type="integer") + */ + private $id; - /** - * @var string $slug - */ - private $slug; + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } - /** - * @var datetime $created_at - */ - private $created_at; + /** + * @var string $title + * @ORM\Column(type="string", length=100) + */ + private $title; - /** - * @var datetime $updated_at - */ - private $updated_at; + /** + * Set title + * + * @param string $title + * @return ForumTopic + */ + public function setTitle($title) + { + $this->title = $title; + return $this; + } - /** - * @var text $update_reason - */ - private $update_reason; + /** + * Get title + * + * @return string + */ + public function getTitle() + { + return $this->title; + } - /** - * @var KekRozsak\FrontBundle\Entity\User - */ - private $created_by; + /** + * @var string $slug + * @ORM\Column(type="string", length=100) + */ + private $slug; - /** - * @var KekRozsak\FrontBundle\Entity\User - */ - private $updated_by; + /** + * Set slug + * + * @param string $slug + * @return ForumTopic + */ + public function setSlug($slug) + { + $this->slug = $slug; + return $this; + } - /** - * @var KekRozsak\FrontBundle\Entity\ForumTopicGroup - */ - private $topic_group; + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } + /** + * @var datetime $createdAt + * @ORM\Column(type="datetime", name="created_at") + */ + private $createdAt; - /** - * Get id - * - * @return integer - */ - public function getId() - { - return $this->id; - } + /** + * Set createdAt + * + * @param DateTime $createdAt + * @return ForumTopic + */ + public function setCreatedAt($createdAt) + { + $this->createdAt = $createdAt; + return $this; + } - /** - * Set title - * - * @param string $title - * @return ForumTopic - */ - public function setTitle($title) - { - $this->title = $title; - return $this; - } + /** + * Get createdAt + * + * @return DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } - /** - * Get title - * - * @return string - */ - public function getTitle() - { - return $this->title; - } + /** + * @var User + * @ORM\ManyToOne(targetEntity="User") + * @ORM\JoinColumn(name="created_by_id") + */ + private $createdBy; - /** - * Set slug - * - * @param string $slug - * @return ForumTopic - */ - public function setSlug($slug) - { - $this->slug = $slug; - return $this; - } + /** + * Set createdBy + * + * @param User $createdBy + * @return ForumTopic + */ + public function setCreatedBy(\User $createdBy) + { + $this->createdBy = $createdBy; + return $this; + } - /** - * Get slug - * - * @return string - */ - public function getSlug() - { - return $this->slug; - } + /** + * Get createdBy + * + * @return User + */ + public function getCreatedBy() + { + return $this->createdBy; + } - /** - * Set created_at - * - * @param datetime $createdAt - * @return ForumTopic - */ - public function setCreatedAt($createdAt) - { - $this->created_at = $createdAt; - return $this; - } + /** + * @var datetime $updatedAt + * @ORM\Column(type="datetime", name="updated_at", nullable=true) + */ + private $updatedAt; - /** - * Get created_at - * - * @return datetime - */ - public function getCreatedAt() - { - return $this->created_at; - } + /** + * Set updatedAt + * + * @param datetime $updatedAt + * @return ForumTopic + */ + public function setUpdatedAt(\DateTime $updatedAt = null) + { + $this->updatedAt = $updatedAt; + return $this; + } - /** - * Set updated_at - * - * @param datetime $updatedAt - * @return ForumTopic - */ - public function setUpdatedAt($updatedAt) - { - $this->updated_at = $updatedAt; - return $this; - } + /** + * Get updatedAt + * + * @return datetime + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } - /** - * Get updated_at - * - * @return datetime - */ - public function getUpdatedAt() - { - return $this->updated_at; - } + /** + * @var User + * @ORM\ManyToOne(targetEntity="User") + * @ORM\JoinColumn(name="updated_by_id") + */ + private $updatedBy; - /** - * Set update_reason - * - * @param text $updateReason - * @return ForumTopic - */ - public function setUpdateReason($updateReason) - { - $this->update_reason = $updateReason; - return $this; - } + /** + * Set updatedBy + * + * @param User $updatedBy + * @return ForumTopic + */ + public function setUpdatedBy(User $updatedBy = null) + { + $this->updatedBy = $updatedBy; + return $this; + } - /** - * Get update_reason - * - * @return text - */ - public function getUpdateReason() - { - return $this->update_reason; - } + /** + * Get updatedBy + * + * @return User + */ + public function getUpdatedBy() + { + return $this->updatedBy; + } - /** - * Set created_by - * - * @param KekRozsak\FrontBundle\Entity\User $createdBy - * @return ForumTopic - */ - public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy = null) - { - $this->created_by = $createdBy; - return $this; - } + /** + * @var text $updateReason + * @ORM\Column(type="text", name="update_reason") + */ + private $updateReason; - /** - * Get created_by - * - * @return KekRozsak\FrontBundle\Entity\User - */ - public function getCreatedBy() - { - return $this->created_by; - } + /** + * Set updateReason + * + * @param text $updateReason + * @return ForumTopic + */ + public function setUpdateReason($updateReason) + { + $this->updateReason = $updateReason; + return $this; + } - /** - * 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 updateReason + * + * @return text + */ + public function getUpdateReason() + { + return $this->updateReason; + } - /** - * Get updated_by - * - * @return KekRozsak\FrontBundle\Entity\User - */ - public function getUpdatedBy() - { - return $this->updated_by; - } + /** + * @var ForumTopicGroup + * @ORM\ManyToOne(targetEntity="ForumTopicGroup") + * @ORM\JoinColumn(name="topic_group_id", referencedColumnName="id") + */ + private $topicGroup; - /** - * 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; - } + /** + * Set topicGroup + * + * @param ForumTopicGroup $topicGroup + * @return ForumTopic + */ + public function setTopicGroup(ForumTopicGroup $topicGroup) + { + $this->topicGroup = $topicGroup; + return $this; + } - /** - * Get topic_group - * - * @return KekRozsak\FrontBundle\Entity\ForumTopicGroup - */ - public function getTopicGroup() - { - return $this->topic_group; - } - /** - * @var \Doctrine\Common\Collections\ArrayCollection - */ - private $posts; + /** + * Get topicGroup + * + * @return ForumTopicGroup + */ + public function getTopicGroup() + { + return $this->topicGroup; + } + /** + * @var \Doctrine\Common\Collections\ArrayCollection + * @ORM\OneToMany(targetEntity="ForumPost", mappedBy="topic") + */ + private $posts; - public function __construct() - { - $this->posts = new \Doctrine\Common\Collections\ArrayCollection(); - } - - /** - * Add posts - * - * @param KekRozsak\FrontBundle\Entity\ForumPost $posts - * @return ForumTopic - */ - public function addForumPost(\KekRozsak\FrontBundle\Entity\ForumPost $posts) - { - $this->posts[] = $posts; - return $this; - } + /** + * Add posts + * + * @param ForumPost $posts + * @return ForumTopic + */ + public function addForumPost(ForumPost $posts) + { + $this->posts[] = $posts; + return $this; + } - /** - * Get posts - * - * @return Doctrine\Common\Collections\Collection - */ - public function getPosts() - { - return $this->posts; - } - /** - * @var KekRozsak\FrontBundle\Entity\ForumPost - */ - private $lastPost; + /** + * Get posts + * + * @return Doctrine\Common\Collections\Collection + */ + public function getPosts() + { + return $this->posts; + } + /** + * @var ForumPost + * @ORM\OneToOne(targetEntity="ForumPost", cascade={"persist"}) + * @ORM\JoinColumn(name="last_post_id", referencedColumnName="id") + */ + private $lastPost; - /** - * Set lastPost - * - * @param KekRozsak\FrontBundle\Entity\ForumPost $lastPost - * @return ForumTopic - */ - public function setLastPost(\KekRozsak\FrontBundle\Entity\ForumPost $lastPost) - { - $this->lastPost = $lastPost; - $this->topic_group->setLastPost($lastPost); - return $this; - } + /** + * Set lastPost + * + * @param ForumPost $lastPost + * @return ForumTopic + */ + public function setLastPost(ForumPost $lastPost = null) + { + $this->lastPost = $lastPost; + $this->topicGroup->setLastPost($lastPost); + return $this; + } - /** - * Get lastPost - * - * @return KekRozsak\FrontBundle\Entity\ForumPost - */ - public function getLastPost() - { - return $this->lastPost; - } - /** - * @var KekRozsak\FrontBundle\Entity\ForumPost - */ - private $last_post; - - -} \ No newline at end of file + /** + * Get lastPost + * + * @return ForumPost + */ + public function getLastPost() + { + return $this->lastPost; + } +} diff --git a/src/KekRozsak/FrontBundle/Entity/ForumTopicGroup.php b/src/KekRozsak/FrontBundle/Entity/ForumTopicGroup.php index 03da5f4..4e1c615 100644 --- a/src/KekRozsak/FrontBundle/Entity/ForumTopicGroup.php +++ b/src/KekRozsak/FrontBundle/Entity/ForumTopicGroup.php @@ -4,292 +4,280 @@ namespace KekRozsak\FrontBundle\Entity; 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 + * @ORM\Entity + * @ORM\Table(name="forum_topic_groups") */ class ForumTopicGroup { - /** - * @var integer $id - */ - private $id; + public function __construct() + { + $this->topic = new \Doctrine\Common\Collections\ArrayCollection(); + } - /** - * @var string $title - */ - private $title; + /** + * @var integer $id + * @ORM\Id + * @ORM\GeneratedValue(strategy="AUTO") + * @ORM\Column(type="integer") + */ + private $id; - /** - * @var string $slug - */ - private $slug; + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } - /** - * @var datetime $created_at - */ - private $created_at; + /** + * @var string $title + * @ORM\Column(type="string", length=100, unique=true) + */ + private $title; - /** - * @var datetime $updated_at - */ - private $updated_at; + /** + * Set title + * + * @param string $title + * @return ForumTopicGroup + */ + public function setTitle($title) + { + $this->title = $title; + return $this; + } - /** - * @var text $update_reason - */ - private $update_reason; + /** + * Get title + * + * @return string + */ + public function getTitle() + { + return $this->title; + } - /** - * @var KekRozsak\FrontBundle\Entity\User - */ - private $created_by; + /** + * @var string $slug + * @ORM\Column(type="string", length=100, unique=true) + */ + private $slug; - /** - * @var KekRozsak\FrontBundle\Entity\User - */ - private $updated_by; + /** + * 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; + } - /** - * Get id - * - * @return integer - */ - public function getId() - { - return $this->id; - } + /** + * @var datetime $createdAt + * @ORM\Column(type="datetime", name="created_at") + */ + private $createdAt; - /** - * Set title - * - * @param string $title - * @return ForumTopicGroup - */ - public function setTitle($title) - { - $this->title = $title; - return $this; - } + /** + * Set createdAt + * + * @param DateTime $createdAt + * @return ForumTopicGroup + */ + public function setCreatedAt(\DateTime $createdAt) + { + $this->createdAt = $createdAt; + return $this; + } - /** - * Get title - * - * @return string - */ - public function getTitle() - { - return $this->title; - } + /** + * Get createdAt + * + * @return DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } - /** - * Set slug - * - * @param string $slug - * @return ForumTopicGroup - */ - public function setSlug($slug) - { - $this->slug = $slug; - return $this; - } + /** + * @var User + * @ORM\ManyToOne(targetEntity="User") + * @ORM\JoinColumn(name="created_by_id") + */ + private $createdBy; - /** - * Get slug - * - * @return string - */ - public function getSlug() - { - return $this->slug; - } + /** + * Set createdBy + * + * @param User $createdBy + * @return ForumTopicGroup + */ + public function setCreatedBy(User $createdBy) + { + $this->createdBy = $createdBy; + return $this; + } - /** - * Set created_at - * - * @param datetime $createdAt - * @return ForumTopicGroup - */ - public function setCreatedAt($createdAt) - { - $this->created_at = $createdAt; - return $this; - } + /** + * Get createdBy + * + * @return User + */ + public function getCreatedBy() + { + return $this->createdBy; + } - /** - * Get created_at - * - * @return datetime - */ - public function getCreatedAt() - { - return $this->created_at; - } + /** + * @var datetime $updatedAt + * @ORM\Column(type="datetime", name="updated_at", nullable=true) + */ + private $updatedAt; - /** - * Set updated_at - * - * @param datetime $updatedAt - * @return ForumTopicGroup - */ - public function setUpdatedAt($updatedAt) - { - $this->updated_at = $updatedAt; - return $this; - } + /** + * Set updatedAt + * + * @param DateTime $updatedAt + * @return ForumTopicGroup + */ + public function setUpdatedAt(\DateTime $updatedAt = null) + { + $this->updatedAt = $updatedAt; + return $this; + } - /** - * Get updated_at - * - * @return datetime - */ - public function getUpdatedAt() - { - return $this->updated_at; - } + /** + * Get updatedAt + * + * @return datetime + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } - /** - * Set update_reason - * - * @param text $updateReason - * @return ForumTopicGroup - */ - public function setUpdateReason($updateReason) - { - $this->update_reason = $updateReason; - return $this; - } + /** + * @var User + * @ORM\ManyToOne(targetEntity="User") + * @ORM\JoinColumn(name="updated_by_id") + */ + private $updatedBy; - /** - * Get update_reason - * - * @return text - */ - public function getUpdateReason() - { - return $this->update_reason; - } + /** + * Set updatedBy + * + * @param User $updatedBy + * @return ForumTopicGroup + */ + public function setUpdatedBy(User $updatedBy = null) + { + $this->updatedBy = $updatedBy; + return $this; + } - /** - * Set created_by - * - * @param KekRozsak\FrontBundle\Entity\User $createdBy - * @return ForumTopicGroup - */ - public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy = null) - { - $this->created_by = $createdBy; - return $this; - } + /** + * Get updatedBy + * + * @return User + */ + public function getUpdatedBy() + { + return $this->updatedBy; + } - /** - * Get created_by - * - * @return KekRozsak\FrontBundle\Entity\User - */ - public function getCreatedBy() - { - return $this->created_by; - } + /** + * @var text $update_reason + * @ORM\Column(type="text", name="update_reason", nullable=true) + */ + private $updateReason; - /** - * 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; - } + /** + * Set updateReason + * + * @param text $updateReason + * @return ForumTopicGroup + */ + public function setUpdateReason($updateReason = null) + { + $this->updateReason = $updateReason; + return $this; + } - /** - * Get updated_by - * - * @return KekRozsak\FrontBundle\Entity\User - */ - public function getUpdatedBy() - { - return $this->updated_by; - } - /** - * @var \Doctrine\Common\Collections\ArrayCollection - */ - private $topic; + /** + * Get updateReason + * + * @return text + */ + public function getUpdateReason() + { + return $this->updateReason; + } - 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; - } + /** + * @var ForumPost + * @ORM\OneToOne(targetEntity="ForumPost", cascade={"persist"}) + * @ORM\JoinColumn(name="last_post_id") + */ + private $lastPost; - /** - * Get topic - * - * @return Doctrine\Common\Collections\Collection - */ - public function getTopic() - { - return $this->topic; - } - /** - * @var \Doctrine\Common\Collections\ArrayCollection - */ - private $topics; + /** + * 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; + } - /** - * Get topics - * - * @return Doctrine\Common\Collections\Collection - */ - public function getTopics() - { - return $this->topics; - } - /** - * @var KekRozsak\FrontBundle\Entity\ForumPost - */ - private $lastPost; + /** + * @var \Doctrine\Common\Collections\ArrayCollection + * @ORM\OneToMany(targetEntity="ForumTopic", mappedBy="topicGroup") + */ + private $topics; - - /** - * 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; - - -} \ No newline at end of file + /** + * Get topics + * + * @return Doctrine\Common\Collections\Collection + */ + public function getTopics() + { + return $this->topics; + } +} diff --git a/src/KekRozsak/FrontBundle/Entity/Group.php b/src/KekRozsak/FrontBundle/Entity/Group.php new file mode 100644 index 0000000..8699828 --- /dev/null +++ b/src/KekRozsak/FrontBundle/Entity/Group.php @@ -0,0 +1,261 @@ +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; +} diff --git a/src/KekRozsak/FrontBundle/Entity/News.php b/src/KekRozsak/FrontBundle/Entity/News.php index faebccc..177b653 100644 --- a/src/KekRozsak/FrontBundle/Entity/News.php +++ b/src/KekRozsak/FrontBundle/Entity/News.php @@ -6,238 +6,252 @@ use Doctrine\ORM\Mapping as ORM; /** * KekRozsak\FrontBundle\Entity\News + * @ORM\Entity + * @ORM\Table(name="news") */ class News { - /** - * @var integer $id - */ - private $id; + /** + * @var integer $id + * @ORM\Id + * @ORM\GeneratedValue(strategy="AUTO") + * @ORM\Column(type="integer", name="id") + */ + private $id; - /** - * @var datetime $created_at - */ - private $created_at; + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } - /** - * @var datetime $updated_at - */ - private $updated_at; + /** + * @var datetime $createdAt + * @ORM\Column(type="datetime", name="created_at") + */ + private $createdAt; - /** - * @var text $update_reason - */ - private $update_reason; + /** + * Set createdAt + * + * @param datetime $createdAt + * @return News + */ + public function setCreatedAt($createdAt) + { + $this->createdAt = $createdAt; + return $this; + } - /** - * @var string $title - */ - private $title; + /** + * Get createdAt + * + * @return datetime + */ + public function getCreatedAt() + { + return $this->createdAt; + } - /** - * @var string $slug - */ - private $slug; + /** + * @var datetime $updatedAt + * @ORM\Column(type="datetime", name="updated_at", nullable=true) + */ + private $updatedAt; - /** - * @var text $text - */ - private $text; + /** + * @var text $updateReason + * @ORM\Column(type="text", name="update_reason", nullable=true) + */ + private $updateReason; - /** - * @var KekRozsak\FrontBundle\Entity\User - */ - private $created_by; + /** + * @var string $title + * @ORM\Column(type="string", length=100, nullable=false) + */ + private $title; - /** - * @var KekRozsak\FrontBundle\Entity\User - */ - private $updated_by; + /** + * @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; - /** - * Get id - * - * @return integer - */ - public function getId() - { - return $this->id; - } + /** + * @var KekRozsak\FrontBundle\Entity\User $createdBy + * @ORM\ManyToOne(targetEntity="User") + * @ORM\JoinColumn(name="created_by_id", referencedColumnName="id") + */ + private $createdBy; - /** - * Set created_at - * - * @param datetime $createdAt - * @return News - */ - public function setCreatedAt($createdAt) - { - $this->created_at = $createdAt; - return $this; - } + /** + * @var KekRozsak\FrontBundle\Entity\User $updatedBy + * @ORM\ManyToOne(targetEntity="User", fetch="EXTRA_LAZY") + * @ORM\JoinColumn(name="updated_by_id", referencedColumnName="id") + */ + private $updatedBy; - /** - * Get created_at - * - * @return datetime - */ - public function getCreatedAt() - { - return $this->created_at; - } + /** + * Set updatedAt + * + * @param datetime $updatedAt + * @return News + */ + public function setUpdatedAt($updatedAt) + { + $this->updatedAt = $updatedAt; + return $this; + } - /** - * Set updated_at - * - * @param datetime $updatedAt - * @return News - */ - public function setUpdatedAt($updatedAt) - { - $this->updated_at = $updatedAt; - return $this; - } + /** + * Get updatedAt + * + * @return datetime + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } - /** - * Get updated_at - * - * @return datetime - */ - public function getUpdatedAt() - { - return $this->updated_at; - } + /** + * Set updateReason + * + * @param text $updateReason + * @return News + */ + public function setUpdateReason($updateReason) + { + $this->updateReason = $updateReason; + return $this; + } - /** - * Set update_reason - * - * @param text $updateReason - * @return News - */ - public function setUpdateReason($updateReason) - { - $this->update_reason = $updateReason; - return $this; - } + /** + * Get updateReason + * + * @return text + */ + public function getUpdateReason() + { + return $this->updateReason; + } - /** - * Get update_reason - * - * @return text - */ - public function getUpdateReason() - { - return $this->update_reason; - } + /** + * Set title + * + * @param string $title + * @return News + */ + public function setTitle($title) + { + $this->title = $title; + return $this; + } - /** - * Set title - * - * @param string $title - * @return News - */ - public function setTitle($title) - { - $this->title = $title; - return $this; - } + /** + * Get title + * + * @return string + */ + public function getTitle() + { + return $this->title; + } - /** - * Get title - * - * @return string - */ - public function getTitle() - { - return $this->title; - } + /** + * Set slug + * + * @param string $slug + * @return News + */ + public function setSlug($slug) + { + $this->slug = $slug; + return $this; + } - /** - * Set slug - * - * @param string $slug - * @return News - */ - public function setSlug($slug) - { - $this->slug = $slug; - return $this; - } + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } - /** - * Get slug - * - * @return string - */ - public function getSlug() - { - return $this->slug; - } + /** + * Set text + * + * @param text $text + * @return News + */ + public function setText($text) + { + $this->text = $text; + return $this; + } - /** - * Set text - * - * @param text $text - * @return News - */ - public function setText($text) - { - $this->text = $text; - return $this; - } + /** + * Get text + * + * @return text + */ + public function getText() + { + return $this->text; + } - /** - * Get text - * - * @return text - */ - public function getText() - { - return $this->text; - } + /** + * Set createdBy + * + * @param KekRozsak\FrontBundle\Entity\User $createdBy + * @return News + */ + public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy = null) + { + $this->createdBy = $createdBy; + return $this; + } - /** - * Set created_by - * - * @param KekRozsak\FrontBundle\Entity\User $createdBy - * @return News - */ - public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy = null) - { - $this->created_by = $createdBy; - return $this; - } + /** + * Get createdBy + * + * @return KekRozsak\FrontBundle\Entity\User + */ + public function getCreatedBy() + { + return $this->createdBy; + } - /** - * Get created_by - * - * @return KekRozsak\FrontBundle\Entity\User - */ - public function getCreatedBy() - { - return $this->created_by; - } + /** + * Set updatedBy + * + * @param KekRozsak\FrontBundle\Entity\User $updatedBy + * @return News + */ + public function setUpdatedBy(\KekRozsak\FrontBundle\Entity\User $updatedBy = null) + { + $this->updatedBy = $updatedBy; + return $this; + } - /** - * Set updated_by - * - * @param KekRozsak\FrontBundle\Entity\User $updatedBy - * @return News - */ - 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; - } -} \ No newline at end of file + /** + * Get updatedBy + * + * @return KekRozsak\FrontBundle\Entity\User + */ + public function getUpdatedBy() + { + return $this->updatedBy; + } +} diff --git a/src/KekRozsak/FrontBundle/Entity/Poll.php b/src/KekRozsak/FrontBundle/Entity/Poll.php new file mode 100644 index 0000000..fb58181 --- /dev/null +++ b/src/KekRozsak/FrontBundle/Entity/Poll.php @@ -0,0 +1,292 @@ +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; + } +} diff --git a/src/KekRozsak/FrontBundle/Entity/PollAnswer.php b/src/KekRozsak/FrontBundle/Entity/PollAnswer.php new file mode 100644 index 0000000..d82401b --- /dev/null +++ b/src/KekRozsak/FrontBundle/Entity/PollAnswer.php @@ -0,0 +1,265 @@ +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; + } +} diff --git a/src/KekRozsak/FrontBundle/Entity/Role.php b/src/KekRozsak/FrontBundle/Entity/Role.php deleted file mode 100644 index a988273..0000000 --- a/src/KekRozsak/FrontBundle/Entity/Role.php +++ /dev/null @@ -1,145 +0,0 @@ -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; - } -} \ No newline at end of file diff --git a/src/KekRozsak/FrontBundle/Entity/User.php b/src/KekRozsak/FrontBundle/Entity/User.php index 3b2cfef..5e17fd3 100644 --- a/src/KekRozsak/FrontBundle/Entity/User.php +++ b/src/KekRozsak/FrontBundle/Entity/User.php @@ -5,360 +5,484 @@ 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 - */ - private $id; + /** + * @var integer $id + * @ORM\Id + * @ORM\GeneratedValue(strategy="AUTO") + * @ORM\Column(type="integer") + */ + private $id; - /** - * @var string $username - */ - private $username; + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } - /** - * @var string $password - */ - private $password; + /** + * @var string $username + * @ORM\Column(type="string", length=50, nullable=false, unique=true) + * @Assert\NotBlank(groups={"registration"}) + */ + private $username; - /** - * @var string $email - */ - private $email; + /** + * Set username + * + * @param string $username + * @return User + */ + public function setUsername($username) + { + $this->username = $username; + return $this; + } - /** - * @var DateTime $registered_at - */ - private $registered_at; + /** + * Get username + * + * @return string + */ + public function getUsername() + { + return $this->username; + } - /** - * @var string $display_name - */ - private $display_name; + /** + * @var string $password + * @ORM\Column(type="string", length=50, nullable=false) + * @Assert\NotBlank(groups={"registration"}) + */ + private $password; - /** - * @var \Doctrine\Common\Collections\ArrayCollection - */ - private $roles; + /** + * Set password + * + * @param string $password + * @return User + */ + public function setPassword($password) + { + $this->password = $password; + return $this; + } - public function __construct() - { - $this->roles = new \Doctrine\Common\Collections\ArrayCollection(); - } - - /** - * Get id - * - * @return integer - */ - public function getId() - { - return $this->id; - } + /** + * Get password + * + * @return string + */ + public function getPassword() + { + return $this->password; + } - /** - * Set username - * - * @param string $username - * @return User - */ - public function setUsername($username) - { - $this->username = $username; - return $this; - } + /** + * @var string $email + * @ORM\Column(type="string", length=50, unique=true, nullable=false) + * @Assert\NotBlank(groups={"registration"}) + * @Assert\Email(groups={"registration"}) + */ + private $email; - /** - * Get username - * - * @return string - */ - public function getUsername() - { - return $this->username; - } + /** + * Set email + * + * @param string $email + * @return User + */ + public function setEmail($email) + { + $this->email = $email; + return $this; + } - /** - * Set password - * - * @param string $password - * @return User - */ - public function setPassword($password) - { - $this->password = $password; - return $this; - } + /** + * Get email + * + * @return string + */ + public function getEmail() + { + return $this->email; + } - /** - * Get password - * - * @return string - */ - public function getPassword() - { - return $this->password; - } + /** + * @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 email - * - * @param string $email - * @return User - */ - public function setEmail($email) - { - $this->email = $email; - return $this; - } + /** + * Set registeredAt + * + * @param DateTime $registeredAt + * @return User + */ + public function setRegisteredAt(\DateTime $registeredAt) + { + $this->registeredAt = $registeredAt; + return $this; + } - /** - * Get email - * - * @return string - */ - public function getEmail() - { - return $this->email; - } + /** + * Get registeredAt + * + * @return DateTime + */ + public function getRegisteredAt() + { + return $this->registeredAt; + } - /** - * Set registered_at - * - * @param DateTime $registeredAt - * @return User - */ - public function setRegisteredAt(\DateTime $registeredAt) - { - $this->registered_at = $registeredAt; - return $this; - } + /** + * @var string $displayName + * @ORM\Column(type="string", length=50, nullable=false, unique=true, name="display_name") + */ + private $displayName; - /** - * Get registered_at - * - * @return DateTime - */ - public function getRegisteredAt() - { - return $this->registered_at; - } + /** + * Set displayName + * + * @param string $displayName + * @return User + */ + public function setDisplayName($displayName) + { + $this->displayName = $displayName; + return $this; + } - /** - * Set display_name - * - * @param string $displayName - * @return User - */ - public function setDisplayName($displayName) - { - $this->display_name = $displayName; - return $this; - } + /** + * Get displayName + * + * @return string + */ + public function getDisplayName() + { + return $this->displayName; + } - /** - * Get display_name - * - * @return string - */ - public function getDisplayName() - { - return $this->display_name; - } + /** + * @var User $acceptedBy + * @ORM\ManyToOne(targetEntity="User", fetch="EXTRA_LAZY") + * @ORM\JoinColumn(name="accepted_by_id", referencedColumnName="id") + */ + private $acceptedBy; - /** - * Add roles - * - * @param KekRozsak\FrontBundle\Entity\Role $roles - * @return User - */ - public function addRole(\KekRozsak\FrontBundle\Entity\Role $roles) - { - $this->roles[] = $roles; - return $this; - } + /** + * Set acceptedBy + * + * @param User $acceptedBy + * @return User + */ + public function setAcceptedBy(User $acceptedBy = null) + { + $this->acceptedBy = $acceptedBy; + return $this; + } - /** - * Get roles - * - * @return Doctrine\Common\Collections\Collection - */ - public function getRoles() - { - return $this->roles->toArray(); - } + /** + * Get acceptedBy + * + * @return User + */ + public function getAcceptedBy() + { + return $this->acceptedBy; + } - public function getRolesCollection() - { - return $this->roles; - } + /** + * @var datetime $lastLoginAt + * @ORM\Column(type="datetime", nullable=true, name="last_login_at") + */ + private $lastLoginAt; - public function eraseCredentials() - { - } + /** + * Set lastLoginAt + * + * @param DateTime $lastLoginAt + * @return User + */ + public function setLastLoginAt(\DateTime $lastLoginAt = null) + { + $this->lastLoginAt = $lastLoginAt; + return $this; + } - public function getSalt() - { - return $this->password; - } - /** - * @var \Doctrine\Common\Collections\ArrayCollection - */ - private $articles; + /** + * Get lastLoginAt + * + * @return DateTime + */ + public function getLastLoginAt() + { + return $this->lastLoginAt; + } - /** - * @var \Doctrine\Common\Collections\ArrayCollection - */ - private $forum_posts; + /** + * @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; + } - /** - * Add articles - * - * @param KekRozsak\FrontBundle\Entity\Article $articles - * @return User - */ - public function addArticle(\KekRozsak\FrontBundle\Entity\Article $articles) - { - $this->articles[] = $articles; - return $this; - } + /** + * Get articles + * + * @return Doctrine\Common\Collections\Collection + */ + public function getArticles() + { + return $this->articles; + } - /** - * 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 forum_posts - * - * @param KekRozsak\FrontBundle\Entity\ForumPost $forumPosts - * @return User - */ - public function addForumPost(\KekRozsak\FrontBundle\Entity\ForumPost $forumPosts) - { - $this->forum_posts[] = $forumPosts; - return $this; - } + /** + * Add forumPosts + * + * @param ForumPost $forumPosts + * @return User + */ + public function addForumPost(ForumPost $forumPosts) + { + $this->forumPosts[] = $forumPosts; + return $this; + } - /** - * Get forum_posts - * - * @return Doctrine\Common\Collections\Collection - */ - public function getForumPosts() - { - return $this->forum_posts; - } - /** - * @var KekRozsak\FrontBundle\Entity\User - */ - private $accepted_by; + /** + * 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; - /** - * Set accepted_by - * - * @param KekRozsak\FrontBundle\Entity\User $acceptedBy - * @return User - */ - public function setAcceptedBy(\KekRozsak\FrontBundle\Entity\User $acceptedBy = null) - { - $this->accepted_by = $acceptedBy; - return $this; - } + /** + * Add ledGroups + * + * @param Group $group + * @return User + */ + public function addGroup(Group $group) + { + $this->ledGroups[] = $group; + return $this; + } - /** - * Get accepted_by - * - * @return KekRozsak\FrontBundle\Entity\User - */ - public function getAcceptedBy() - { - return $this->accepted_by; - } + /** + * Get ledGroups + * + * @return Doctrine\Common\Collections\Collection + */ + public function getLedGroups() + { + return $this->ledGroups; + } - public function isAccountNonExpired() - { - return true; - } - - public function isAccountNonLocked() - { - return true; - } - - public function isCredentialsNonExpired() - { - return true; - } - - public function isEnabled() - { - return ($this->accepted_by !== null); - } - /** - * @var datetime $last_login_at - */ - private $last_login_at; + /** + * @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; + } - /** - * Set last_login_at - * - * @param datetime $lastLoginAt - * @return User - */ - public function setLastLoginAt($lastLoginAt) - { - $this->last_login_at = $lastLoginAt; - return $this; - } + /** + * Get createdDocuments + * + * @return Doctrine\Common\Collections\Collection + */ + public function getCreatedDocuments() + { + return $this->createdDocuments; + } - /** - * Get last_login_at - * - * @return datetime - */ - public function getLastLoginAt() - { - return $this->last_login_at; - } - /** - * @var KekRozsak\FrontBundle\Entity\UserData - */ - private $user_data; + /** + * @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; + } - /** - * 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 userData + * + * @return UserData + */ + public function getUserData() + { + return $this->userData; + } - /** - * Get user_data - * - * @return KekRozsak\FrontBundle\Entity\UserData - */ - public function getUserData() - { - return $this->user_data; - } -} \ No newline at end of file + /** + * @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); + } +} diff --git a/src/KekRozsak/FrontBundle/Entity/UserData.php b/src/KekRozsak/FrontBundle/Entity/UserData.php index 490fec7..04fb724 100644 --- a/src/KekRozsak/FrontBundle/Entity/UserData.php +++ b/src/KekRozsak/FrontBundle/Entity/UserData.php @@ -4,388 +4,379 @@ namespace KekRozsak\FrontBundle\Entity; use Doctrine\ORM\Mapping as ORM; +use KekRozsak\FrontBundle\Entity\User; + /** * KekRozsak\FrontBundle\Entity\UserData + * @ORM\Entity + * @ORM\Table(name="user_data") */ class UserData { - /** - * @var KekRozsak\FrontBundle\Entity\User - */ - private $user; + /** + * @var User $user + * @ORM\Id + * @ORM\OneToOne(targetEntity="User", inversedBy="userData") + * @ORM\JoinColumn(name="user_id", referencedColumnName="id") + */ + protected $user; + /** + * Set user + * + * @param User $user + * @return UserData + */ + public function setUser(User $user = null) + { + $this->user = $user; + $this->userId = $user->getId(); + return $this; + } - /** - * Set user - * - * @param KekRozsak\FrontBundle\Entity\User $user - * @return UserData - */ - public function setUser(\KekRozsak\FrontBundle\Entity\User $user = null) - { - $this->user = $user; - $this->user_id = $user->getId(); - return $this; - } + /** + * Get user + * + * @return User + */ + public function getUser() + { + return $this->user; + } - /** - * Get user - * - * @return KekRozsak\FrontBundle\Entity\User - */ - public function getUser() - { - return $this->user; - } - /** - * @var integer $user_id - */ - private $user_id; + /** + * @var boolean $emailPublic + * @ORM\Column(type="boolean", name="email_public") + */ + protected $emailPublic; - /** - * @var string $realName - */ - private $realName; + /** + * Set emailPublic + * + * @param boolean $emailPublic + * @return UserData + */ + public function setEmailPublic($emailPublic) + { + $this->emailPublic = $emailPublic; + return $this; + } - /** - * @var boolean $realNamePublic - */ - private $realNamePublic; + /** + * Get emailPublic + * + * @return boolean + */ + public function getEmailPublic() + { + return $this->emailPublic; + } + /** + * @var string $realName + * @ORM\Column(name="real_name", type="string", length=100, nullable=true) + */ + protected $realName; - /** - * Set user_id - * - * @param integer $userId - * @return UserData - */ - public function setUserId($userId) - { - $this->user_id = $userId; - return $this; - } + /** + * Set realName + * + * @param string $realName + * @return UserData + */ + public function setRealName($realName) + { + $this->realName = $realName; + return $this; + } - /** - * Get user_id - * - * @return integer - */ - public function getUserId() - { - return $this->user_id; - } + /** + * Get realName + * + * @return string + */ + public function getRealName() + { + return $this->realName; + } - /** - * Set realName - * - * @param string $realName - * @return UserData - */ - public function setRealName($realName) - { - $this->realName = $realName; - return $this; - } + /** + * @var boolean $realNamePublic + * @ORM\Column(name="real_name_public", type="boolean", nullable=false) + */ + protected $realNamePublic; - /** - * Get realName - * - * @return string - */ - public function getRealName() - { - return $this->realName; - } + /** + * Set realNamePublic + * + * @param boolean $realNamePublic + * @return UserData + */ + public function setRealNamePublic($realNamePublic) + { + $this->realNamePublic = $realNamePublic; + return $this; + } - /** - * Set realNamePublic - * - * @param boolean $realNamePublic - * @return UserData - */ - public function setRealNamePublic($realNamePublic) - { - $this->realNamePublic = $realNamePublic; - return $this; - } + /** + * Get realNamePublic + * + * @return boolean + */ + public function getRealNamePublic() + { + return $this->realNamePublic; + } - /** - * Get realNamePublic - * - * @return boolean - */ - public function getRealNamePublic() - { - return $this->realNamePublic; - } - /** - * @var text $selfDescription - */ - private $selfDescription; + /** + * @var text $selfDescription + * @ORM\Column(name="self_description", type="text", nullable=true) + */ + protected $selfDescription; - /** - * @var boolean $emailPublic - */ - private $emailPublic; + /** + * Set selfDescription + * + * @param text $selfDescription + * @return UserData + */ + public function setSelfDescription($selfDescription) + { + $this->selfDescription = $selfDescription; + return $this; + } + /** + * Get selfDescription + * + * @return text + */ + public function getSelfDescription() + { + return $this->selfDescription; + } - /** - * Set selfDescription - * - * @param text $selfDescription - * @return UserData - */ - public function setSelfDescription($selfDescription) - { - $this->selfDescription = $selfDescription; - return $this; - } + /** + * @var string $msnAddress + * @ORM\Column(type="string", length=100, name="msn_address", nullable=true) + */ + protected $msnAddress; - /** - * Get selfDescription - * - * @return text - */ - public function getSelfDescription() - { - return $this->selfDescription; - } + /** + * Set msnAddress + * + * @param string $msnAddress + * @return UserData + */ + public function setMsnAddress($msnAddress) + { + $this->msnAddress = $msnAddress; + return $this; + } - /** - * Set emailPublic - * - * @param boolean $emailPublic - * @return UserData - */ - public function setEmailPublic($emailPublic) - { - $this->emailPublic = $emailPublic; - return $this; - } + /** + * Get msnAddress + * + * @return string + */ + public function getMsnAddress() + { + return $this->msnAddress; + } - /** - * Get emailPublic - * - * @return boolean - */ - public function getEmailPublic() - { - return $this->emailPublic; - } - /** - * @var string $msnAddress - */ - private $msnAddress; + /** + * @var boolean $msnAddressPublic + * @ORM\Column(type="boolean", name="msn_address_public", nullable=false) + */ + protected $msnAddressPublic; - /** - * @var boolean $msnAddressPublic - */ - private $msnAddressPublic; + /** + * Set msnAddressPublic + * + * @param boolean $msnAddressPublic + * @return UserData + */ + public function setMsnAddressPublic($msnAddressPublic) + { + $this->msnAddressPublic = $msnAddressPublic; + return $this; + } - /** - * @var string $googleTalk - */ - private $googleTalk; + /** + * Get msnAddressPublic + * + * @return boolean + */ + public function getMsnAddressPublic() + { + return $this->msnAddressPublic; + } - /** - * @var boolean $googleTalkPublic - */ - private $googleTalkPublic; + /** + * @var string $googleTalk + * @ORM\Column(type="string", length=100, name="google_talk", nullable=true) + */ + protected $googleTalk; - /** - * @var string $skype - */ - private $skype; + /** + * Set googleTalk + * + * @param string $googleTalk + * @return UserData + */ + public function setGoogleTalk($googleTalk) + { + $this->googleTalk = $googleTalk; + return $this; + } - /** - * @var boolean $skypePublic - */ - private $skypePublic; + /** + * Get googleTalk + * + * @return string + */ + public function getGoogleTalk() + { + return $this->googleTalk; + } + /** + * @var boolean $googleTalkPublic + * @ORM\Column(type="boolean", name="google_talk_public", nullable=false) + */ + protected $googleTalkPublic; - /** - * Set msnAddress - * - * @param string $msnAddress - * @return UserData - */ - public function setMsnAddress($msnAddress) - { - $this->msnAddress = $msnAddress; - return $this; - } + /** + * Set googleTalkPublic + * + * @param boolean $googleTalkPublic + * @return UserData + */ + public function setGoogleTalkPublic($googleTalkPublic) + { + $this->googleTalkPublic = $googleTalkPublic; + return $this; + } - /** - * Get msnAddress - * - * @return string - */ - public function getMsnAddress() - { - return $this->msnAddress; - } + /** + * Get googleTalkPublic + * + * @return boolean + */ + public function getGoogleTalkPublic() + { + return $this->googleTalkPublic; + } - /** - * Set msnAddressPublic - * - * @param boolean $msnAddressPublic - * @return UserData - */ - public function setMsnAddressPublic($msnAddressPublic) - { - $this->msnAddressPublic = $msnAddressPublic; - return $this; - } + /** + * @var string $skype + * @ORM\Column(type="string", length=100, nullable=true) + */ + protected $skype; - /** - * Get msnAddressPublic - * - * @return boolean - */ - public function getMsnAddressPublic() - { - return $this->msnAddressPublic; - } + /** + * Set skype + * + * @param string $skype + * @return UserData + */ + public function setSkype($skype) + { + $this->skype = $skype; + return $this; + } - /** - * Set googleTalk - * - * @param string $googleTalk - * @return UserData - */ - public function setGoogleTalk($googleTalk) - { - $this->googleTalk = $googleTalk; - return $this; - } + /** + * Get skype + * + * @return string + */ + public function getSkype() + { + return $this->skype; + } - /** - * Get googleTalk - * - * @return string - */ - public function getGoogleTalk() - { - return $this->googleTalk; - } + /** + * @var boolean $skypePublic + * @ORM\Column(type="boolean", name="skype_public", nullable=false) + */ + protected $skypePublic; - /** - * Set googleTalkPublic - * - * @param boolean $googleTalkPublic - * @return UserData - */ - public function setGoogleTalkPublic($googleTalkPublic) - { - $this->googleTalkPublic = $googleTalkPublic; - return $this; - } + /** + * Set skypePublic + * + * @param boolean $skypePublic + * @return UserData + */ + public function setSkypePublic($skypePublic) + { + $this->skypePublic = $skypePublic; + return $this; + } - /** - * Get googleTalkPublic - * - * @return boolean - */ - public function getGoogleTalkPublic() - { - return $this->googleTalkPublic; - } + /** + * Get skypePublic + * + * @return boolean + */ + public function getSkypePublic() + { + return $this->skypePublic; + } - /** - * Set skype - * - * @param string $skype - * @return UserData - */ - public function setSkype($skype) - { - $this->skype = $skype; - return $this; - } + /** + * @var string $phoneNumber + * @ORM\Column(type="string", length=30, name="phone_number", nullable=true) + */ + protected $phoneNumber; - /** - * Get skype - * - * @return string - */ - public function getSkype() - { - return $this->skype; - } + /** + * Set phoneNumber + * + * @param string $phoneNumber + * @return UserData + */ + public function setPhoneNumber($phoneNumber = null) + { + $this->phoneNumber = $phoneNumber; + return $this; + } - /** - * Set skypePublic - * - * @param boolean $skypePublic - * @return UserData - */ - public function setSkypePublic($skypePublic) - { - $this->skypePublic = $skypePublic; - return $this; - } + /** + * Get phoneNumber + * + * @return string + */ + public function getPhoneNumber() + { + return $this->phoneNumber; + } - /** - * Get skypePublic - * - * @return boolean - */ - public function getSkypePublic() - { - return $this->skypePublic; - } - /** - * @var string $phoneNumber - */ - private $phoneNumber; + /** + * @var boolean $phoneNumberPublic + * @ORM\Column(type="boolean", name="phone_number_public", nullable=false) + */ + protected $phoneNumberPublic; - /** - * @var boolean $phoneNumberPublic - */ - private $phoneNumberPublic; + /** + * Set phoneNumberPublic + * + * @param boolean $phoneNumberPublic + * @return UserData + */ + public function setPhoneNumberPublic($phoneNumberPublic) + { + $this->phoneNumberPublic = $phoneNumberPublic; + return $this; + } - - /** - * Set phoneNumber - * - * @param string $phoneNumber - * @return UserData - */ - public function setPhoneNumber($phoneNumber) - { - $this->phoneNumber = $phoneNumber; - return $this; - } - - /** - * Get phoneNumber - * - * @return string - */ - public function getPhoneNumber() - { - return $this->phoneNumber; - } - - /** - * Set phoneNumberPublic - * - * @param boolean $phoneNumberPublic - * @return UserData - */ - public function setPhoneNumberPublic($phoneNumberPublic) - { - $this->phoneNumberPublic = $phoneNumberPublic; - return $this; - } - - /** - * Get phoneNumberPublic - * - * @return boolean - */ - public function getPhoneNumberPublic() - { - return $this->phoneNumberPublic; - } + /** + * Get phoneNumberPublic + * + * @return boolean + */ + public function getPhoneNumberPublic() + { + return $this->phoneNumberPublic; + } } diff --git a/src/KekRozsak/FrontBundle/Form/Type/ForumPostType.php b/src/KekRozsak/FrontBundle/Form/Type/ForumPostType.php index 1aff774..7a8fdb1 100644 --- a/src/KekRozsak/FrontBundle/Form/Type/ForumPostType.php +++ b/src/KekRozsak/FrontBundle/Form/Type/ForumPostType.php @@ -17,7 +17,7 @@ class ForumPostType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->add('created_at', 'hidden', array( + $builder->add('createdAt', 'hidden', array( 'label' => 'Időpont', 'data' => new \DateTime('now') )); diff --git a/src/KekRozsak/FrontBundle/Form/Type/UserType.php b/src/KekRozsak/FrontBundle/Form/Type/UserType.php index 98121d7..10af594 100644 --- a/src/KekRozsak/FrontBundle/Form/Type/UserType.php +++ b/src/KekRozsak/FrontBundle/Form/Type/UserType.php @@ -42,7 +42,7 @@ class UserType extends AbstractType )); if (!$this->_registration) { - $builder->add('user_data', new UserDataType(), array( + $builder->add('userData', new UserDataType(), array( 'label' => 'Egyéb adatok', )); } diff --git a/src/KekRozsak/FrontBundle/Resources/config/doctrine/Article.orm.yml b/src/KekRozsak/FrontBundle/Resources/config/doctrine/Article.orm.yml deleted file mode 100644 index ef09ac6..0000000 --- a/src/KekRozsak/FrontBundle/Resources/config/doctrine/Article.orm.yml +++ /dev/null @@ -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 diff --git a/src/KekRozsak/FrontBundle/Resources/config/doctrine/ForumPost.orm.yml b/src/KekRozsak/FrontBundle/Resources/config/doctrine/ForumPost.orm.yml deleted file mode 100644 index ab5191b..0000000 --- a/src/KekRozsak/FrontBundle/Resources/config/doctrine/ForumPost.orm.yml +++ /dev/null @@ -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 diff --git a/src/KekRozsak/FrontBundle/Resources/config/doctrine/ForumTopic.orm.yml b/src/KekRozsak/FrontBundle/Resources/config/doctrine/ForumTopic.orm.yml deleted file mode 100644 index 1ced916..0000000 --- a/src/KekRozsak/FrontBundle/Resources/config/doctrine/ForumTopic.orm.yml +++ /dev/null @@ -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 ] diff --git a/src/KekRozsak/FrontBundle/Resources/config/doctrine/ForumTopicGroup.orm.yml b/src/KekRozsak/FrontBundle/Resources/config/doctrine/ForumTopicGroup.orm.yml deleted file mode 100644 index 5e3aec8..0000000 --- a/src/KekRozsak/FrontBundle/Resources/config/doctrine/ForumTopicGroup.orm.yml +++ /dev/null @@ -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 diff --git a/src/KekRozsak/FrontBundle/Resources/config/doctrine/News.orm.yml b/src/KekRozsak/FrontBundle/Resources/config/doctrine/News.orm.yml deleted file mode 100644 index 0be2fd3..0000000 --- a/src/KekRozsak/FrontBundle/Resources/config/doctrine/News.orm.yml +++ /dev/null @@ -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 diff --git a/src/KekRozsak/FrontBundle/Resources/config/doctrine/Role.orm.yml b/src/KekRozsak/FrontBundle/Resources/config/doctrine/Role.orm.yml deleted file mode 100644 index 1e94cc9..0000000 --- a/src/KekRozsak/FrontBundle/Resources/config/doctrine/Role.orm.yml +++ /dev/null @@ -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 - diff --git a/src/KekRozsak/FrontBundle/Resources/config/doctrine/User.orm.yml b/src/KekRozsak/FrontBundle/Resources/config/doctrine/User.orm.yml deleted file mode 100644 index 70e6170..0000000 --- a/src/KekRozsak/FrontBundle/Resources/config/doctrine/User.orm.yml +++ /dev/null @@ -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' ] diff --git a/src/KekRozsak/FrontBundle/Resources/config/doctrine/UserData.orm.yml b/src/KekRozsak/FrontBundle/Resources/config/doctrine/UserData.orm.yml deleted file mode 100644 index fab2a4b..0000000 --- a/src/KekRozsak/FrontBundle/Resources/config/doctrine/UserData.orm.yml +++ /dev/null @@ -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 diff --git a/src/KekRozsak/FrontBundle/Resources/config/routing.yml b/src/KekRozsak/FrontBundle/Resources/config/routing.yml deleted file mode 100644 index 2b0fc09..0000000 --- a/src/KekRozsak/FrontBundle/Resources/config/routing.yml +++ /dev/null @@ -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 diff --git a/src/KekRozsak/FrontBundle/Resources/config/services.xml b/src/KekRozsak/FrontBundle/Resources/config/services.xml new file mode 100644 index 0000000..c89e72b --- /dev/null +++ b/src/KekRozsak/FrontBundle/Resources/config/services.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/src/KekRozsak/FrontBundle/Resources/config/services.yml b/src/KekRozsak/FrontBundle/Resources/config/services.yml deleted file mode 100644 index c19fc24..0000000 --- a/src/KekRozsak/FrontBundle/Resources/config/services.yml +++ /dev/null @@ -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" } diff --git a/src/KekRozsak/FrontBundle/Resources/config/validation.yml b/src/KekRozsak/FrontBundle/Resources/config/validation.yml deleted file mode 100644 index 796c79e..0000000 --- a/src/KekRozsak/FrontBundle/Resources/config/validation.yml +++ /dev/null @@ -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: - diff --git a/src/KekRozsak/FrontBundle/Resources/views/Forum/post_list.html.twig b/src/KekRozsak/FrontBundle/Resources/views/Forum/post_list.html.twig index d2ad117..816e78b 100644 --- a/src/KekRozsak/FrontBundle/Resources/views/Forum/post_list.html.twig +++ b/src/KekRozsak/FrontBundle/Resources/views/Forum/post_list.html.twig @@ -6,7 +6,7 @@ -
+ {{ form_widget(form) }}

Súgó diff --git a/src/KekRozsak/FrontBundle/Twig/NewsExtension.php b/src/KekRozsak/FrontBundle/Twig/NewsExtension.php index 153f73a..506cf4a 100644 --- a/src/KekRozsak/FrontBundle/Twig/NewsExtension.php +++ b/src/KekRozsak/FrontBundle/Twig/NewsExtension.php @@ -16,7 +16,7 @@ class NewsExtension extends \Twig_Extension public function getGlobals() { $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( 'recentNews' => $news, diff --git a/src/KekRozsak/SecurityBundle/Controller/DefaultController.php b/src/KekRozsak/SecurityBundle/Controller/DefaultController.php index 5b94216..7926f5f 100644 --- a/src/KekRozsak/SecurityBundle/Controller/DefaultController.php +++ b/src/KekRozsak/SecurityBundle/Controller/DefaultController.php @@ -6,12 +6,16 @@ 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 KekRozsak\FrontBundle\Entity\User; use KekRozsak\FrontBundle\Form\Type\UserType; class DefaultController extends Controller { + /** + * @Route("/login", name="KekRozsakSecurityBundle_login") + */ public function loginAction() { $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) { $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() { return $this->render('KekRozsakSecurityBundle:Default:registration_success.html.twig', array()); diff --git a/src/KekRozsak/SecurityBundle/Resources/config/routing.yml b/src/KekRozsak/SecurityBundle/Resources/config/routing.yml deleted file mode 100644 index 4aa2771..0000000 --- a/src/KekRozsak/SecurityBundle/Resources/config/routing.yml +++ /dev/null @@ -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 diff --git a/src/KekRozsak/SecurityBundle/Resources/views/Default/registration.html.twig b/src/KekRozsak/SecurityBundle/Resources/views/Default/registration.html.twig index 562f46a..563b1c1 100644 --- a/src/KekRozsak/SecurityBundle/Resources/views/Default/registration.html.twig +++ b/src/KekRozsak/SecurityBundle/Resources/views/Default/registration.html.twig @@ -1,4 +1,5 @@ -{# vim: ft=htmljinja: #} +{# vim: ft=htmljinja: +#} {% extends '::main_template.html.twig' %} {% form_theme form 'KekRozsakFrontBundle:Form:user_form.html.twig' %} {% block title %} - Regisztráció {% endblock %}