]> git.immae.eu Git - github/wallabag/wallabag.git/blame - src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSiteCredentialData.php
Merge pull request #3966 from wallabag/prepare-2.3.8
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / DataFixtures / ORM / LoadSiteCredentialData.php
CommitLineData
b8427f22
JB
1<?php
2
3namespace Wallabag\CoreBundle\DataFixtures\ORM;
4
5use Doctrine\Common\DataFixtures\AbstractFixture;
6use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
7use Doctrine\Common\Persistence\ObjectManager;
35359bd3
JB
8use Symfony\Component\DependencyInjection\ContainerAwareInterface;
9use Symfony\Component\DependencyInjection\ContainerInterface;
b8427f22
JB
10use Wallabag\CoreBundle\Entity\SiteCredential;
11
35359bd3 12class LoadSiteCredentialData extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface
b8427f22 13{
35359bd3
JB
14 /**
15 * @var ContainerInterface
16 */
17 private $container;
18
19 public function setContainer(ContainerInterface $container = null)
20 {
21 $this->container = $container;
22 }
23
b8427f22
JB
24 /**
25 * {@inheritdoc}
26 */
27 public function load(ObjectManager $manager)
28 {
29 $credential = new SiteCredential($this->getReference('admin-user'));
35359bd3
JB
30 $credential->setHost('.super.com');
31 $credential->setUsername($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('.super'));
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'));
b8427f22
JB
40
41 $manager->persist($credential);
42
43 $manager->flush();
44 }
45
46 /**
47 * {@inheritdoc}
48 */
49 public function getOrder()
50 {
51 return 50;
52 }
53}