Minor - Fix repo services + fix guide

pull/2635/head
Julio Montoya 6 years ago
parent 339de65b2a
commit 726bd31224
  1. 4
      README.md
  2. 25
      src/FaqBundle/Repository/CategoryRepository.php
  3. 20
      src/FaqBundle/Repository/QuestionRepository.php
  4. 3
      src/FaqBundle/Resources/config/services.yml

@ -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),

@ -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)

@ -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')

@ -1,6 +1,3 @@
services:
_defaults:
autowire: true
Chamilo\FaqBundle\Repository\:
resource: ../../Repository

Loading…
Cancel
Save