2018-11-23 22:09:29 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\DataFixtures;
|
|
|
|
|
|
|
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
|
|
|
use Doctrine\Common\Persistence\ObjectManager;
|
|
|
|
use App\Entity\Source\Primitive\Text\TextSource;
|
|
|
|
use App\Entity\Source\Primitive\Text\TextSourceInterface;
|
|
|
|
use App\DBAL\Types\SystemSlugType;
|
2018-12-31 21:18:03 +01:00
|
|
|
use App\Entity\Source\Complex\UserSource;
|
|
|
|
use App\Entity\Source\Complex\UserSourceInterface;
|
2018-11-23 22:09:29 +01:00
|
|
|
|
|
|
|
class SourceFixtures extends Fixture
|
|
|
|
{
|
|
|
|
public function load(ObjectManager $manager)
|
|
|
|
{
|
|
|
|
$manager->persist($this->getImpressum());
|
2018-12-31 21:18:03 +01:00
|
|
|
$manager->persist($this->getGuestUser());
|
2018-11-23 22:09:29 +01:00
|
|
|
$manager->flush();
|
|
|
|
}
|
|
|
|
|
2018-12-31 21:18:03 +01:00
|
|
|
/**
|
|
|
|
* @return TextSourceInterface The example source for the impressum
|
|
|
|
*/
|
2018-11-23 22:09:29 +01:00
|
|
|
private function getImpressum(): TextSourceInterface
|
|
|
|
{
|
|
|
|
$source = new TextSource();
|
|
|
|
$source->setText('Example Impressum');
|
|
|
|
$source->setSlug(SystemSlugType::IMPRINT);
|
|
|
|
|
|
|
|
return $source;
|
|
|
|
}
|
2018-12-31 21:18:03 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @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;
|
|
|
|
}
|
2018-11-23 22:09:29 +01:00
|
|
|
}
|