Stuff
This commit is contained in:
1 parent
e6ad944f79
commit
657975324a
15 files changed
+190
-23
No files matched your search
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Lewisdale\App\Controllers;
|
||||
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
use Lewisdale\App\Models\Repositories\FeedRepository;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Slim\Views\Twig;
|
||||
|
||||
class FeedController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly Twig $view,
|
||||
private readonly LoggerInterface $logger,
|
||||
private readonly FeedRepository $feedRepository
|
||||
) {}
|
||||
|
||||
public function get(ServerRequestInterface $request, ResponseInterface $response)
|
||||
{
|
||||
$this->logger->info("FeedController::get() called");
|
||||
$feeds = $this->feedRepository->findBy([], ['title' => 'ASC']);
|
||||
return $this->view->render($response, 'index.twig.html', ['feeds' => $feeds]);
|
||||
}
|
||||
|
||||
public function create(ServerRequestInterface $request, ResponseInterface $response)
|
||||
{
|
||||
$this->logger->info("FeedController::create() called");
|
||||
$body = $request->getParsedBody();
|
||||
|
||||
return $this->view->render($response, 'create.twig.html');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user