src/CourseBundle/Repository/CGlossaryRepository.php
<?php
declare(strict_types=1);
/* For licensing terms, see /license.txt */
namespace Chamilo\CourseBundle\Repository;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\ResourceInterface;
use Chamilo\CoreBundle\Entity\ResourceNode;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Repository\ResourceRepository;
use Chamilo\CoreBundle\Repository\ResourceWithLinkInterface;
use Chamilo\CourseBundle\Entity\CGlossary;
use Chamilo\CourseBundle\Entity\CGroup;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Routing\RouterInterface;
final class CGlossaryRepository extends ResourceRepository implements ResourceWithLinkInterface
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, CGlossary::class);
}
/*public function getResources(User $user, ResourceNode $parentNode, Course $course = null, Session $session = null, CGroup $group = null): QueryBuilder
{
return $this->getResourcesByCourse($course, $session, $group, $parentNode);
}*/
public function getLink(ResourceInterface $resource, RouterInterface $router, array $extraParams = []): string
{
$params = [
'name' => 'glossary/index.php',
'glossary_id' => $resource->getResourceIdentifier(),
];
if (!empty($extraParams)) {
$params = array_merge($params, $extraParams);
}
return $router->generate('legacy_main', $params);
}
}