%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/tjamichg/cursos.tjamich.gob.mx/src/Chamilo/CoreBundle/Entity/Repository/
Upload File :
Create Path :
Current File : //home/tjamichg/cursos.tjamich.gob.mx/src/Chamilo/CoreBundle/Entity/Repository/LegalRepository.php

<?php
/* For licensing terms, see /license.txt */

namespace Chamilo\CoreBundle\Entity\Repository;

use Doctrine\ORM\EntityRepository;

/**
 * Class LegalRepository.
 *
 * @package Chamilo\CoreBundle\Entity\Repository
 */
class LegalRepository extends EntityRepository
{
    /**
     * Count the legal terms by language (only count one set of terms for each
     * language).
     *
     * @throws \Exception
     *
     * @return int
     */
    public function countAllActiveLegalTerms()
    {
        $qb = $this->createQueryBuilder('l');
        $qb->select('l.languageId, COUNT(l.id)')
            ->groupBy('l.languageId');

        return count($qb->getQuery()->getResult());
    }

    /**
     * Get the latest version of terms of the given type and language.
     *
     * @param int $typeId     The type of terms:
     *                        0 for general text,
     *                        1 for general HTML link,
     *                        101 for private data collection,
     *                        etc - see personal_data.php
     * @param int $languageId The Id of the language
     *
     * @return array The terms for those type and language
     */
    public function findOneByTypeAndLanguage($typeId, $languageId)
    {
        $qb = $this->createQueryBuilder('l');
        $qb->select('l.content')
            ->where($qb->expr()->eq('l.type', $typeId))
            ->andWhere($qb->expr()->eq('l.languageId', $languageId));

        return $qb->getQuery()->getResult();
    }
}

Zerion Mini Shell 1.0