mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 13:57:10 +02:00
Implemented source data fixtures for guest user
This commit is contained in:
@@ -13,7 +13,10 @@ final class SystemSlugType extends AbstractEnumType
|
||||
{
|
||||
public const IMPRINT = 'IMPRINT';
|
||||
|
||||
public const GUEST_USER = 'GUEST_USER';
|
||||
|
||||
protected static $choices = [
|
||||
self::IMPRINT => 'imprint',
|
||||
self::GUEST_USER => 'guest user',
|
||||
];
|
||||
}
|
||||
|
@@ -7,15 +7,21 @@ use Doctrine\Common\Persistence\ObjectManager;
|
||||
use App\Entity\Source\Primitive\Text\TextSource;
|
||||
use App\Entity\Source\Primitive\Text\TextSourceInterface;
|
||||
use App\DBAL\Types\SystemSlugType;
|
||||
use App\Entity\Source\Complex\UserSource;
|
||||
use App\Entity\Source\Complex\UserSourceInterface;
|
||||
|
||||
class SourceFixtures extends Fixture
|
||||
{
|
||||
public function load(ObjectManager $manager)
|
||||
{
|
||||
$manager->persist($this->getImpressum());
|
||||
$manager->persist($this->getGuestUser());
|
||||
$manager->flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TextSourceInterface The example source for the impressum
|
||||
*/
|
||||
private function getImpressum(): TextSourceInterface
|
||||
{
|
||||
$source = new TextSource();
|
||||
@@ -24,4 +30,15 @@ class SourceFixtures extends Fixture
|
||||
|
||||
return $source;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return UserSourceInterface The UserSource which should be used for the anonymous user
|
||||
*/
|
||||
private function getGuestUser(): UserSourceInterface
|
||||
{
|
||||
$source = new UserSource();
|
||||
$source->setSlug(SystemSlugType::GUEST_USER);
|
||||
|
||||
return $source;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user