From 726bd31224ad309a1132b62ea8638928b3acd919 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 16 Aug 2018 14:42:28 +0200 Subject: [PATCH] Minor - Fix repo services + fix guide --- README.md | 4 +-- .../Repository/CategoryRepository.php | 25 +++++-------------- .../Repository/QuestionRepository.php | 20 +++------------ src/FaqBundle/Resources/config/services.yml | 5 +--- 4 files changed, 13 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 6e29612d71..4f76df0d69 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Chamilo is an e-learning platform, also called "LMS" or "LCMS" published under G ## Quick install -If you want a detail and explanation of all of the steps please read the "Install Guide". +If you want a detail and explanation of all of the steps please read the "Installation Guide". We assume you have already installed "yarn" and "composer" and you're installing the portal in a domain, not in a sub folder inside a domain. @@ -38,7 +38,7 @@ chmod -R 777 .env app var public main/default_course_document/images/ Then enter the main/install/index.php and follow the UI instructions (database, admin user settings, etc). -## Install guide (Dev environment, stable environment not yet available) +## Installation guide (Dev environment, stable environment not yet available) The instructions above are meant only for stable versions. If you are a developer and want to contribute to Chamilo in the current development branch (not stable yet), diff --git a/src/FaqBundle/Repository/CategoryRepository.php b/src/FaqBundle/Repository/CategoryRepository.php index 0874f37424..9e94ef7b39 100644 --- a/src/FaqBundle/Repository/CategoryRepository.php +++ b/src/FaqBundle/Repository/CategoryRepository.php @@ -4,34 +4,21 @@ namespace Chamilo\FaqBundle\Repository; use Chamilo\FaqBundle\Entity\Category; -use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\EntityRepository; /** * Class CategoryRepository. * * @package Genj\FaqBundle\Entity */ -class CategoryRepository +class CategoryRepository extends EntityRepository { - /** @var \Doctrine\Common\Persistence\ObjectRepository EN */ - private $repository; - - /** - * CategoryRepository constructor. - * - * @param EntityManagerInterface $entityManager - */ - public function __construct(EntityManagerInterface $entityManager) - { - $this->repository = $entityManager->getRepository(Category::class); - } - /** * @return mixed */ public function retrieveActive() { - $query = $this->repository->createQueryBuilder('c') + $query = $this->createQueryBuilder('c') ->where('c.isActive = :isActive') ->orderBy('c.rank', 'ASC') ->getQuery(); @@ -48,7 +35,7 @@ class CategoryRepository */ public function retrieveActiveBySlug($slug) { - $query = $this->repository->createQueryBuilder('c') + $query = $this->createQueryBuilder('c') ->where('c.isActive = :isActive') ->andWhere('c.slug = :slug') ->orderBy('c.rank', 'ASC') @@ -67,7 +54,7 @@ class CategoryRepository */ public function getCategoryActiveBySlug($slug) { - $query = $this->repository->createQueryBuilder('c') + $query = $this->createQueryBuilder('c') ->join('c.translations', 't') ->where('c.isActive = :isActive') ->andWhere('t.slug = :slug') @@ -84,7 +71,7 @@ class CategoryRepository */ public function retrieveFirst() { - $query = $this->repository->createQueryBuilder('c') + $query = $this->createQueryBuilder('c') ->where('c.isActive = :isActive') ->orderBy('c.rank', 'ASC') ->setMaxResults(1) diff --git a/src/FaqBundle/Repository/QuestionRepository.php b/src/FaqBundle/Repository/QuestionRepository.php index 6279afa1ba..d9a59687af 100644 --- a/src/FaqBundle/Repository/QuestionRepository.php +++ b/src/FaqBundle/Repository/QuestionRepository.php @@ -4,27 +4,15 @@ namespace Chamilo\FaqBundle\Repository; use Chamilo\FaqBundle\Entity\Question; -use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\EntityRepository; /** * Class QuestionRepository. * * @package Genj\FaqBundle\Entity */ -class QuestionRepository +class QuestionRepository extends EntityRepository { - private $repository; - - /** - * QuestionRepository constructor. - * - * @param EntityManagerInterface $entityManager - */ - public function __construct(EntityManagerInterface $entityManager) - { - $this->repository = $entityManager->getRepository(Question::class); - } - /** * @param string $categorySlug * @@ -32,7 +20,7 @@ class QuestionRepository */ public function retrieveFirstByCategorySlug($categorySlug) { - $query = $this->repository->createQueryBuilder('q') + $query = $this->createQueryBuilder('q') ->join('q.category', 'c') ->join('c.translations', 't') ->where('t.slug = :categorySlug') @@ -52,7 +40,7 @@ class QuestionRepository */ public function getQuestionBySlug($slug) { - $query = $this->repository->createQueryBuilder('q') + $query = $this->createQueryBuilder('q') ->join('q.translations', 't') ->where('t.slug = :slug') ->orderBy('q.rank', 'ASC') diff --git a/src/FaqBundle/Resources/config/services.yml b/src/FaqBundle/Resources/config/services.yml index 6eee5ecec0..7d760fde39 100644 --- a/src/FaqBundle/Resources/config/services.yml +++ b/src/FaqBundle/Resources/config/services.yml @@ -1,6 +1,3 @@ services: _defaults: - autowire: true - - Chamilo\FaqBundle\Repository\: - resource: ../../Repository + autowire: true \ No newline at end of file