mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-04-16 10:16:22 +02: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\Routing\Annotation\Route;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
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.
|
* This controller offers the standart routes for the template.
|
||||||
@ -17,6 +21,16 @@ final class DefaultController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
public function homepage(): Response
|
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 = static::createClient();
|
||||||
$client->request('GET', '/');
|
$client->request('GET', '/');
|
||||||
$this->assertEquals(200, $client->getResponse()
|
$this->assertEquals(302, $client->getResponse()
|
||||||
->getStatusCode());
|
->getStatusCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user