From e7d8ad8138bd5cd33a4b70517d57cf3fa27c0da1 Mon Sep 17 00:00:00 2001 From: spitd1 Date: Mon, 31 Oct 2016 00:05:39 +0100 Subject: [PATCH 1/8] New FAQ entity and repository --- src/AppBundle/Entity/FAQ.php | 97 ++++++++++++++++++++++ src/AppBundle/Repository/FAQRepository.php | 13 +++ 2 files changed, 110 insertions(+) create mode 100644 src/AppBundle/Entity/FAQ.php create mode 100644 src/AppBundle/Repository/FAQRepository.php diff --git a/src/AppBundle/Entity/FAQ.php b/src/AppBundle/Entity/FAQ.php new file mode 100644 index 0000000..2a970af --- /dev/null +++ b/src/AppBundle/Entity/FAQ.php @@ -0,0 +1,97 @@ +id; + } + + /** + * Set question + * + * @param string $question + * + * @return FAQ + */ + public function setQuestion($question) + { + $this->question = $question; + + return $this; + } + + /** + * Get question + * + * @return string + */ + public function getQuestion() + { + return $this->question; + } + + /** + * Set answer + * + * @param string $answer + * + * @return FAQ + */ + public function setAnswer($answer) + { + $this->answer = $answer; + + return $this; + } + + /** + * Get answer + * + * @return string + */ + public function getAnswer() + { + return $this->answer; + } +} + diff --git a/src/AppBundle/Repository/FAQRepository.php b/src/AppBundle/Repository/FAQRepository.php new file mode 100644 index 0000000..04683e0 --- /dev/null +++ b/src/AppBundle/Repository/FAQRepository.php @@ -0,0 +1,13 @@ + Date: Mon, 31 Oct 2016 12:18:10 +0100 Subject: [PATCH 2/8] New FAQ controller and facade --- src/AppBundle/Controller/FAQController.php | 37 ++++++++++++++++++++++ src/AppBundle/Facade/FAQFacade.php | 20 ++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 src/AppBundle/Controller/FAQController.php create mode 100644 src/AppBundle/Facade/FAQFacade.php diff --git a/src/AppBundle/Controller/FAQController.php b/src/AppBundle/Controller/FAQController.php new file mode 100644 index 0000000..ddafe52 --- /dev/null +++ b/src/AppBundle/Controller/FAQController.php @@ -0,0 +1,37 @@ +faqFacade = $faqFacade; + } + + /** + * @Route("/faq", name="faq") + * @Template("faq/faq.html.twig") + */ + public function faqDetailAction() + { + $faq = $this->faqFacade->getAll(); + if (!$faq) { + throw new NotFoundHttpException("Žádné otázky a odpovědi nenalezeny."); + } + + return [ + "faq" => $faq, + ]; + } +} \ No newline at end of file diff --git a/src/AppBundle/Facade/FAQFacade.php b/src/AppBundle/Facade/FAQFacade.php new file mode 100644 index 0000000..beb4a86 --- /dev/null +++ b/src/AppBundle/Facade/FAQFacade.php @@ -0,0 +1,20 @@ +faqRepository = $faqRepository; + } + + public function getAll() { + return $this->faqRepository->findBy([]); + } + +} \ No newline at end of file From 8456b42acbcfea2f8109e355b74a2701ec7d5a04 Mon Sep 17 00:00:00 2001 From: spitd1 Date: Mon, 31 Oct 2016 12:18:37 +0100 Subject: [PATCH 3/8] Revert "New FAQ controller and facade" This reverts commit b8ed118396d40d3c3435fcadf0ee6174eb172b6f. --- src/AppBundle/Controller/FAQController.php | 37 ---------------------- src/AppBundle/Facade/FAQFacade.php | 20 ------------ 2 files changed, 57 deletions(-) delete mode 100644 src/AppBundle/Controller/FAQController.php delete mode 100644 src/AppBundle/Facade/FAQFacade.php diff --git a/src/AppBundle/Controller/FAQController.php b/src/AppBundle/Controller/FAQController.php deleted file mode 100644 index ddafe52..0000000 --- a/src/AppBundle/Controller/FAQController.php +++ /dev/null @@ -1,37 +0,0 @@ -faqFacade = $faqFacade; - } - - /** - * @Route("/faq", name="faq") - * @Template("faq/faq.html.twig") - */ - public function faqDetailAction() - { - $faq = $this->faqFacade->getAll(); - if (!$faq) { - throw new NotFoundHttpException("Žádné otázky a odpovědi nenalezeny."); - } - - return [ - "faq" => $faq, - ]; - } -} \ No newline at end of file diff --git a/src/AppBundle/Facade/FAQFacade.php b/src/AppBundle/Facade/FAQFacade.php deleted file mode 100644 index beb4a86..0000000 --- a/src/AppBundle/Facade/FAQFacade.php +++ /dev/null @@ -1,20 +0,0 @@ -faqRepository = $faqRepository; - } - - public function getAll() { - return $this->faqRepository->findBy([]); - } - -} \ No newline at end of file From ba56ccc57e1dc22142745dcd476e9d3a2f5bf883 Mon Sep 17 00:00:00 2001 From: spitd1 Date: Mon, 31 Oct 2016 12:19:43 +0100 Subject: [PATCH 4/8] Revert "Revert "New FAQ controller and facade"" This reverts commit 8456b42acbcfea2f8109e355b74a2701ec7d5a04. --- src/AppBundle/Controller/FAQController.php | 37 ++++++++++++++++++++++ src/AppBundle/Facade/FAQFacade.php | 20 ++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 src/AppBundle/Controller/FAQController.php create mode 100644 src/AppBundle/Facade/FAQFacade.php diff --git a/src/AppBundle/Controller/FAQController.php b/src/AppBundle/Controller/FAQController.php new file mode 100644 index 0000000..ddafe52 --- /dev/null +++ b/src/AppBundle/Controller/FAQController.php @@ -0,0 +1,37 @@ +faqFacade = $faqFacade; + } + + /** + * @Route("/faq", name="faq") + * @Template("faq/faq.html.twig") + */ + public function faqDetailAction() + { + $faq = $this->faqFacade->getAll(); + if (!$faq) { + throw new NotFoundHttpException("Žádné otázky a odpovědi nenalezeny."); + } + + return [ + "faq" => $faq, + ]; + } +} \ No newline at end of file diff --git a/src/AppBundle/Facade/FAQFacade.php b/src/AppBundle/Facade/FAQFacade.php new file mode 100644 index 0000000..beb4a86 --- /dev/null +++ b/src/AppBundle/Facade/FAQFacade.php @@ -0,0 +1,20 @@ +faqRepository = $faqRepository; + } + + public function getAll() { + return $this->faqRepository->findBy([]); + } + +} \ No newline at end of file From f6cd735854d0bc2b35caa58105b1b892c56fb260 Mon Sep 17 00:00:00 2001 From: spitd1 Date: Mon, 31 Oct 2016 12:20:38 +0100 Subject: [PATCH 5/8] Add FAQ to services --- app/config/services.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/config/services.yml b/app/config/services.yml index 59f9fb4..cf538a2 100644 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -20,6 +20,10 @@ services: class: AppBundle\Controller\UserController autowire: true + app.controller.faq_controller: + class: AppBundle\Controller\FAQController + autowire: true + app.facade.category_facade: class: AppBundle\Facade\CategoryFacade autowire: true @@ -32,6 +36,10 @@ services: class: AppBundle\Facade\UserFacade autowire: true + app.facade.faq_facade: + class: AppBundle\Facade\FAQFacade + autowire: true + app.repository.category_repository: class: AppBundle\Repository\CategoryRepository factory: ['@doctrine.orm.default_entity_manager', getRepository] @@ -42,6 +50,11 @@ services: factory: ['@doctrine.orm.default_entity_manager', getRepository] arguments: ['AppBundle\Entity\Product'] + app.repository.faq_repository: + class: AppBundle\Repository\FAQRepository + factory: ['@doctrine.orm.default_entity_manager', getRepository] + arguments: ['AppBundle\Entity\FAQ'] + encoder: class: Symfony\Component\Security\Core\Encoder\BCryptPasswordEncoder arguments: From c415e722d3e6800aa87e90cc9d19dc5269f37aa0 Mon Sep 17 00:00:00 2001 From: spitd1 Date: Mon, 31 Oct 2016 12:21:09 +0100 Subject: [PATCH 6/8] Add FAQ view --- app/Resources/views/base.html.twig | 3 +++ app/Resources/views/faq/faq.html.twig | 15 +++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 app/Resources/views/faq/faq.html.twig diff --git a/app/Resources/views/base.html.twig b/app/Resources/views/base.html.twig index 4f5d87e..14cc99c 100644 --- a/app/Resources/views/base.html.twig +++ b/app/Resources/views/base.html.twig @@ -46,6 +46,9 @@
  • Domů
  • +
  • + FAQ +
  • +
    +

    {{ faq_item.question }}

    +
    +
    + {{ faq_item.answer }} +
    +
    +
    +{% endfor %} +{% endblock %} \ No newline at end of file From 60719fdec0b58c37b5ce1b15090943909df53b45 Mon Sep 17 00:00:00 2001 From: spitd1 Date: Mon, 31 Oct 2016 13:25:38 +0100 Subject: [PATCH 7/8] New contact form entity and repository --- src/AppBundle/Entity/ContactForm.php | 128 ++++++++++++++++++ .../Repository/ContactFormRepository.php | 13 ++ 2 files changed, 141 insertions(+) create mode 100644 src/AppBundle/Entity/ContactForm.php create mode 100644 src/AppBundle/Repository/ContactFormRepository.php diff --git a/src/AppBundle/Entity/ContactForm.php b/src/AppBundle/Entity/ContactForm.php new file mode 100644 index 0000000..e1019a4 --- /dev/null +++ b/src/AppBundle/Entity/ContactForm.php @@ -0,0 +1,128 @@ +id; + } + + /** + * Set name + * + * @param string $name + * + * @return ContactForm + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set subject + * + * @param string $subject + * + * @return ContactForm + */ + public function setSubject($subject) + { + $this->subject = $subject; + + return $this; + } + + /** + * Get subject + * + * @return string + */ + public function getSubject() + { + return $this->subject; + } + + /** + * Set message + * + * @param string $message + * + * @return ContactForm + */ + public function setMessage($message) + { + $this->message = $message; + + return $this; + } + + /** + * Get message + * + * @return string + */ + public function getMessage() + { + return $this->message; + } +} + diff --git a/src/AppBundle/Repository/ContactFormRepository.php b/src/AppBundle/Repository/ContactFormRepository.php new file mode 100644 index 0000000..b4a2a76 --- /dev/null +++ b/src/AppBundle/Repository/ContactFormRepository.php @@ -0,0 +1,13 @@ + Date: Mon, 31 Oct 2016 16:41:42 +0100 Subject: [PATCH 8/8] Contact form --- app/Resources/views/base.html.twig | 3 ++ .../views/components/contactform.html.twig | 11 +++++ src/AppBundle/FormType/ContactFormType.php | 42 +++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 app/Resources/views/components/contactform.html.twig create mode 100644 src/AppBundle/FormType/ContactFormType.php diff --git a/app/Resources/views/base.html.twig b/app/Resources/views/base.html.twig index 14cc99c..f0ba10b 100644 --- a/app/Resources/views/base.html.twig +++ b/app/Resources/views/base.html.twig @@ -49,6 +49,9 @@
  • FAQ
  • +
  • + Kontakt +