diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSiteCredentialData.php')
-rw-r--r-- | src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSiteCredentialData.php | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSiteCredentialData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSiteCredentialData.php index 866f55a4..faf29da6 100644 --- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSiteCredentialData.php +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSiteCredentialData.php | |||
@@ -5,19 +5,38 @@ namespace Wallabag\CoreBundle\DataFixtures\ORM; | |||
5 | use Doctrine\Common\DataFixtures\AbstractFixture; | 5 | use Doctrine\Common\DataFixtures\AbstractFixture; |
6 | use Doctrine\Common\DataFixtures\OrderedFixtureInterface; | 6 | use Doctrine\Common\DataFixtures\OrderedFixtureInterface; |
7 | use Doctrine\Common\Persistence\ObjectManager; | 7 | use Doctrine\Common\Persistence\ObjectManager; |
8 | use Symfony\Component\DependencyInjection\ContainerAwareInterface; | ||
9 | use Symfony\Component\DependencyInjection\ContainerInterface; | ||
8 | use Wallabag\CoreBundle\Entity\SiteCredential; | 10 | use Wallabag\CoreBundle\Entity\SiteCredential; |
9 | 11 | ||
10 | class LoadSiteCredentialData extends AbstractFixture implements OrderedFixtureInterface | 12 | class LoadSiteCredentialData extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface |
11 | { | 13 | { |
12 | /** | 14 | /** |
15 | * @var ContainerInterface | ||
16 | */ | ||
17 | private $container; | ||
18 | |||
19 | public function setContainer(ContainerInterface $container = null) | ||
20 | { | ||
21 | $this->container = $container; | ||
22 | } | ||
23 | |||
24 | /** | ||
13 | * {@inheritdoc} | 25 | * {@inheritdoc} |
14 | */ | 26 | */ |
15 | public function load(ObjectManager $manager) | 27 | public function load(ObjectManager $manager) |
16 | { | 28 | { |
17 | $credential = new SiteCredential($this->getReference('admin-user')); | 29 | $credential = new SiteCredential($this->getReference('admin-user')); |
18 | $credential->setHost('example.com'); | 30 | $credential->setHost('.super.com'); |
19 | $credential->setUsername('foo'); | 31 | $credential->setUsername($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('.super')); |
20 | $credential->setPassword('bar'); | 32 | $credential->setPassword($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('bar')); |
33 | |||
34 | $manager->persist($credential); | ||
35 | |||
36 | $credential = new SiteCredential($this->getReference('admin-user')); | ||
37 | $credential->setHost('paywall.example.com'); | ||
38 | $credential->setUsername($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('paywall.example')); | ||
39 | $credential->setPassword($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('bar')); | ||
21 | 40 | ||
22 | $manager->persist($credential); | 41 | $manager->persist($credential); |
23 | 42 | ||