Implemented source data fixtures for guest user

This commit is contained in:
Kevin Frantz
2018-12-31 21:18:03 +01:00
parent 8c082bb0a4
commit 8a5845daa9
3 changed files with 31 additions and 7 deletions

View File

@@ -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;
}
}