Revize 343d66a7
Přidáno uživatelem Tomáš Ballák před téměř 5 roky(ů)
website/src/Controller/IndexController.php | ||
---|---|---|
7 | 7 |
use Symfony\Component\HttpFoundation\Response; |
8 | 8 |
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
9 | 9 |
|
10 |
class IndexController extends AbstractController { |
|
11 |
public function index(DocumentManager $dm): Response { |
|
10 |
class IndexController extends AbstractController |
|
11 |
{ |
|
12 |
public function index(DocumentManager $dm): Response |
|
13 |
{ |
|
12 | 14 |
$number = random_int(0, 100); |
13 |
|
|
15 |
$test = new Test(); |
|
16 |
$test->setName('A Foo Bar'); |
|
17 |
|
|
18 |
$dm->persist($test); |
|
19 |
$dm->flush(); |
|
14 | 20 |
$test = $dm->getRepository(Test::class)->findAll(); |
15 |
|
|
16 | 21 |
return new Response( |
17 |
'<html><body>Lucky number: '.$number.'</body></html>'
|
|
22 |
'<html><body>Lucky number: '. ($test ? 'not null' : 'null') .'</body></html>'
|
|
18 | 23 |
); |
19 | 24 |
} |
20 | 25 |
} |
Také k dispozici: Unified diff
new changes