LoadFeedbackData   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 4
c 1
b 1
f 0
lcom 0
cbo 3
dl 0
loc 39
ccs 23
cts 23
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setContainer() 0 3 1
A load() 0 20 2
A getOrder() 0 3 1
1
<?php
2
namespace Developtech\AgilityBundle\DataFixtures\ORM;
3
4
use Doctrine\Common\Persistence\ObjectManager;
5
use Doctrine\Common\DataFixtures\AbstractFixture;
6
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
7
use Symfony\Component\DependencyInjection\ContainerInterface;
8
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
9
use Developtech\AgilityBundle\Entity\Feedback;
10
11
class LoadFeedbackData extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface {
12
    /** @var ContainerInterface */
13
    private $container;
14
    /**
15
     * @param ContainerInterface $container
16
     */
17 1
    public function setContainer(ContainerInterface $container = null) {
18 1
        $this->container = $container;
19 1
    }
20
    /**
21
     * @param ObjectManager $manager
22
     */
23 1
    public function load(ObjectManager $manager) {
24 1
        $data = include('fixtures/feedbacks.php');
25 1
        foreach ($data as $feedbackData)
26
        {
27
            $feedback =
28 1
                (new Feedback())
29 1
                ->setId($feedbackData['id'])
30 1
                ->setProject($this->getReference("project-{$feedbackData['project_id']}"))
31 1
                ->setName($feedbackData['name'])
32 1
                ->setSlug($feedbackData['slug'])
33 1
                ->setDescription($feedbackData['description'])
34 1
                ->setStatus($feedbackData['status'])
35 1
                ->setCreatedAt(new \DateTime($feedbackData['created_at']))
36 1
                ->setUpdatedAt(new \DateTime($feedbackData['updated_at']))
37 1
            ;
38 1
            $manager->persist($feedback);
39 1
        }
40 1
        $manager->flush();
41 1
        $manager->clear(Feedback::class);
42 1
    }
43
    /**
44
     * @return int
45
     */
46 1
    public function getOrder() {
47 1
        return 2;
48
    }
49
}
50