mirror of
https://github.com/wallabag/wallabag.git
synced 2025-01-07 23:45:24 +00:00
57 lines
1.7 KiB
PHP
57 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace Wallabag\CoreBundle\DataFixtures;
|
|
|
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
|
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
|
use Doctrine\Persistence\ObjectManager;
|
|
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
use Wallabag\CoreBundle\Entity\SiteCredential;
|
|
use Wallabag\CoreBundle\Helper\CryptoProxy;
|
|
use Wallabag\UserBundle\DataFixtures\UserFixtures;
|
|
|
|
class SiteCredentialFixtures extends Fixture implements DependentFixtureInterface, ContainerAwareInterface
|
|
{
|
|
/**
|
|
* @var ContainerInterface
|
|
*/
|
|
private $container;
|
|
|
|
public function setContainer(ContainerInterface $container = null)
|
|
{
|
|
$this->container = $container;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function load(ObjectManager $manager): void
|
|
{
|
|
$credential = new SiteCredential($this->getReference('admin-user'));
|
|
$credential->setHost('.super.com');
|
|
$credential->setUsername($this->container->get(CryptoProxy::class)->crypt('.super'));
|
|
$credential->setPassword($this->container->get(CryptoProxy::class)->crypt('bar'));
|
|
|
|
$manager->persist($credential);
|
|
|
|
$credential = new SiteCredential($this->getReference('admin-user'));
|
|
$credential->setHost('paywall.example.com');
|
|
$credential->setUsername($this->container->get(CryptoProxy::class)->crypt('paywall.example'));
|
|
$credential->setPassword($this->container->get(CryptoProxy::class)->crypt('bar'));
|
|
|
|
$manager->persist($credential);
|
|
|
|
$manager->flush();
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function getDependencies()
|
|
{
|
|
return [
|
|
UserFixtures::class,
|
|
];
|
|
}
|
|
}
|