aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/DataFixtures/SiteCredentialFixtures.php
diff options
context:
space:
mode:
authorJérémy Benoist <j0k3r@users.noreply.github.com>2019-05-29 11:14:00 +0200
committerGitHub <noreply@github.com>2019-05-29 11:14:00 +0200
commit73ec68b1ffafb792265a3805833e5cd84c966aed (patch)
tree33c6040c050f85c537f8dbf5e91d8c281db092cd /src/Wallabag/CoreBundle/DataFixtures/SiteCredentialFixtures.php
parent2ba365c7c49556cd23b444dc3bb8d4a8cf08809d (diff)
parent2cbee36a0184786644470a84fdd8c720cfcac58e (diff)
downloadwallabag-73ec68b1ffafb792265a3805833e5cd84c966aed.tar.gz
wallabag-73ec68b1ffafb792265a3805833e5cd84c966aed.tar.zst
wallabag-73ec68b1ffafb792265a3805833e5cd84c966aed.zip
Merge pull request #3984 from wallabag/2.4
Merge 2.4 into master
Diffstat (limited to 'src/Wallabag/CoreBundle/DataFixtures/SiteCredentialFixtures.php')
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/SiteCredentialFixtures.php56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/DataFixtures/SiteCredentialFixtures.php b/src/Wallabag/CoreBundle/DataFixtures/SiteCredentialFixtures.php
new file mode 100644
index 00000000..9a7d116f
--- /dev/null
+++ b/src/Wallabag/CoreBundle/DataFixtures/SiteCredentialFixtures.php
@@ -0,0 +1,56 @@
1<?php
2
3namespace Wallabag\CoreBundle\DataFixtures;
4
5use Doctrine\Bundle\FixturesBundle\Fixture;
6use Doctrine\Common\DataFixtures\DependentFixtureInterface;
7use Doctrine\Common\Persistence\ObjectManager;
8use Symfony\Component\DependencyInjection\ContainerAwareInterface;
9use Symfony\Component\DependencyInjection\ContainerInterface;
10use Wallabag\CoreBundle\Entity\SiteCredential;
11use Wallabag\UserBundle\DataFixtures\UserFixtures;
12
13class SiteCredentialFixtures extends Fixture implements DependentFixtureInterface, ContainerAwareInterface
14{
15 /**
16 * @var ContainerInterface
17 */
18 private $container;
19
20 public function setContainer(ContainerInterface $container = null)
21 {
22 $this->container = $container;
23 }
24
25 /**
26 * {@inheritdoc}
27 */
28 public function load(ObjectManager $manager)
29 {
30 $credential = new SiteCredential($this->getReference('admin-user'));
31 $credential->setHost('.super.com');
32 $credential->setUsername($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('.super'));
33 $credential->setPassword($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('bar'));
34
35 $manager->persist($credential);
36
37 $credential = new SiteCredential($this->getReference('admin-user'));
38 $credential->setHost('paywall.example.com');
39 $credential->setUsername($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('paywall.example'));
40 $credential->setPassword($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('bar'));
41
42 $manager->persist($credential);
43
44 $manager->flush();
45 }
46
47 /**
48 * {@inheritdoc}
49 */
50 public function getDependencies()
51 {
52 return [
53 UserFixtures::class,
54 ];
55 }
56}