src/CourseBundle/Repository/CLpCategoryRepository.php
<?php
declare(strict_types=1);
/* For licensing terms, see /license.txt */
namespace Chamilo\CourseBundle\Repository;
use Chamilo\CoreBundle\Entity\ResourceInterface;
use Chamilo\CoreBundle\Repository\ResourceRepository;
use Chamilo\CoreBundle\Repository\ResourceWithLinkInterface;
use Chamilo\CourseBundle\Entity\CLpCategory;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Routing\RouterInterface;
final class CLpCategoryRepository extends ResourceRepository implements ResourceWithLinkInterface
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, CLpCategory::class);
}
public function getLink(ResourceInterface $resource, RouterInterface $router, array $extraParams = []): string
{
$params = [
'id' => $resource->getResourceIdentifier(),
'name' => 'lp/lp_controller.php',
'action' => 'view_category',
];
if (!empty($extraParams)) {
$params = array_merge($params, $extraParams);
}
return $router->generate('legacy_main', $params);
}
}