[Poll] Fixed ShowPoll route, moved Poll Entity, created NewPollForm

Entity was temporarily moved to src/Entity in order to load from DB, since it is yet no possible to do that from Plugin
This commit is contained in:
Daniel
2020-11-03 15:53:46 +00:00
committed by Hugo Sales
parent 03f02bed4d
commit dbb55362c8
6 changed files with 74 additions and 20 deletions

View File

@@ -21,11 +21,23 @@
namespace Plugin\PollPlugin\Controller;
use App\Entity\Poll;
use App\Util\Common;
use Symfony\Component\HttpFoundation\Request;
class ShowPoll
{
public function showpoll(Request $request)
public function showpoll(Request $request, string $id)
{
$user = Common::ensureLoggedIn();
$poll = Poll::getFromId((int) $id);
//var_dump($poll);
if ($poll == null) {//|| !$poll->isVisibleTo($user)) { todo
throw new NoSuchPollException(); //?
}
return ['_template' => 'base.html.twig'];
}
}