|
|
|
@ -13,10 +13,16 @@ use Symfony\Component\Routing\Attribute\Route; |
|
|
|
|
|
|
|
|
|
|
|
class AuthorController extends AbstractController |
|
|
|
class AuthorController extends AbstractController |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @throws \Exception |
|
|
|
|
|
|
|
*/ |
|
|
|
#[Route('/p/{npub}', name: 'author-profile')] |
|
|
|
#[Route('/p/{npub}', name: 'author-profile')] |
|
|
|
public function index($npub, EntityManagerInterface $entityManager): Response |
|
|
|
public function index($npub, EntityManagerInterface $entityManager): Response |
|
|
|
{ |
|
|
|
{ |
|
|
|
$author = $entityManager->getRepository(User::class)->findOneBy(['npub' => $npub]); |
|
|
|
$author = $entityManager->getRepository(User::class)->findOneBy(['npub' => $npub]); |
|
|
|
|
|
|
|
if (!$author) { |
|
|
|
|
|
|
|
throw new \Exception('No author found'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$articles = $entityManager->getRepository(Article::class)->findBy(['pubkey' => $npub], ['createdAt' => 'DESC']); |
|
|
|
$articles = $entityManager->getRepository(Article::class)->findBy(['pubkey' => $npub], ['createdAt' => 'DESC']); |
|
|
|
|
|
|
|
|
|
|
|
|