summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Controller/Home.php6
-rw-r--r--src/Model/Artwork.php6
2 files changed, 8 insertions, 4 deletions
diff --git a/src/Controller/Home.php b/src/Controller/Home.php
index 7eda5ee..36879e0 100644
--- a/src/Controller/Home.php
+++ b/src/Controller/Home.php
@@ -30,7 +30,11 @@ class Home
public static function dashboard()
{
- return Template::render('dashboard.twig', []);
+ $cards = DB::$entityManager->getRepository(Card::class)->findAll();
+ $cardOfTheDay = $cards[array_rand($cards)];
+ return Template::render('dashboard.twig', [
+ 'cardOfTheDay' => $cardOfTheDay,
+ ]);
}
}
diff --git a/src/Model/Artwork.php b/src/Model/Artwork.php
index 25f6ee5..6380f62 100644
--- a/src/Model/Artwork.php
+++ b/src/Model/Artwork.php
@@ -88,9 +88,9 @@ class Artwork
{
$result = DB::$entityManager
->createQuery(
- 'SELECT sum(v.value) as total
- FROM Elements\Model\VoteArtwork v
- WHERE v.artwork = :artwork'
+ 'SELECT sum(v.value) as total
+ FROM Elements\Model\VoteArtwork v
+ WHERE v.artwork = :artwork'
)
->setParameter('artwork', $this)
->getOneOrNullResult();