Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chamilo-lms/src/CoreBundle/Repository/ExtraFieldOptionsRepository...

46 lines
1.1 KiB

<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Repository;
use Chamilo\CoreBundle\Entity\ExtraFieldOptions;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* Class ExtraFieldOptionsRepository.
*/
class ExtraFieldOptionsRepository extends ServiceEntityRepository
{
/**
* ExtraFieldOptionsRepository constructor.
*/
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, ExtraFieldOptions::class);
}
/**
* Get the secondary options. For double select extra field.
*
* @return array
*/
public function findSecondaryOptions(ExtraFieldOptions $option)
{
$qb = $this->createQueryBuilder('so');
$qb
->where(
$qb->expr()->eq('so.field', $option->getField()->getId())
)
->andWhere(
$qb->expr()->eq('so.value', $option->getId())
)
->orderBy('so.displayText', 'ASC');
return $qb
->getQuery()
->getResult();
}
}