mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2024-12-04 23:17:19 +01:00
Implemented homepage as source
This commit is contained in:
parent
8c9ae85463
commit
3b8fcf5a71
@ -4,6 +4,10 @@ namespace Infinito\Controller;
|
||||
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Infinito\Domain\FixtureManagement\FixtureSource\HomepageFixtureSource;
|
||||
use Infinito\DBAL\Types\Meta\Right\LayerType;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Infinito\DBAL\Types\RESTResponseType;
|
||||
|
||||
/**
|
||||
* This controller offers the standart routes for the template.
|
||||
@ -17,6 +21,16 @@ final class DefaultController extends AbstractController
|
||||
*/
|
||||
public function homepage(): Response
|
||||
{
|
||||
return $this->render('standard/homepage.html.twig');
|
||||
// echo "Hello World!";
|
||||
// $url = $this->generateUrl('infinito_api_rest_layer_read', [
|
||||
// 'identity' => HomepageFixtureSource::SLUG,
|
||||
// 'layer' => LayerType::SOURCE
|
||||
// ]);
|
||||
// return new RedirectResponse($url);
|
||||
return $this->redirectToRoute('infinito_api_rest_layer_read', [
|
||||
'identity' => HomepageFixtureSource::SLUG,
|
||||
'layer' => LayerType::SOURCE,
|
||||
'_format' => RESTResponseType::HTML,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Infinito\Domain\FixtureManagement\FixtureSource;
|
||||
|
||||
use Infinito\Entity\Source\SourceInterface;
|
||||
use Infinito\Entity\Source\Primitive\Text\TextSource;
|
||||
use Infinito\Entity\Meta\Right;
|
||||
use Infinito\DBAL\Types\Meta\Right\LayerType;
|
||||
use Infinito\DBAL\Types\ActionType;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
final class HomepageFixtureSource extends AbstractFixtureSource
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const SLUG = 'HOMEPAGE';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \Infinito\Domain\FixtureManagement\FixtureSource\FixtureSourceInterface::getORMReadyObject()
|
||||
*/
|
||||
public function getORMReadyObject(): SourceInterface
|
||||
{
|
||||
$impressumSource = new TextSource();
|
||||
$impressumSource->setText('Welcome to infinito!');
|
||||
$impressumSource->setSlug(self::SLUG);
|
||||
$right = new Right();
|
||||
$right->setSource($impressumSource);
|
||||
$right->setLayer(LayerType::SOURCE);
|
||||
$right->setActionType(ActionType::READ);
|
||||
$right->setLaw($impressumSource->getLaw());
|
||||
$impressumSource->getLaw()->getRights()->add($right);
|
||||
|
||||
return $impressumSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getSlug(): string
|
||||
{
|
||||
return self::SLUG;
|
||||
}
|
||||
}
|
@ -25,7 +25,7 @@ class DefaultControllerTest extends WebTestCase
|
||||
{
|
||||
$client = static::createClient();
|
||||
$client->request('GET', '/');
|
||||
$this->assertEquals(200, $client->getResponse()
|
||||
$this->assertEquals(302, $client->getResponse()
|
||||
->getStatusCode());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user