LoadOrderData::getOrder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace AppBundle\DataFixtures\ORM;
4
5
use AppBundle\Entity\Order;
6
use Doctrine\Common\Persistence\ObjectManager;
7
8
class LoadOrderData extends Fixture
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function load(ObjectManager $manager)
14
    {
15
        $data = array(
16
            'rows' => array(
17
                array(
18
                    'meal' => 'Part de pizza',
19
                    'quantity' => 1,
20
                    'unit_price' => array('2.00', 'EUR'),
21
                    'price' => array('2.00', 'EUR'),
22
                ),
23
                array(
24
                    'meal' => 'Muffin',
25
                    'quantity' => 2,
26
                    'unit_price' => array('4.00', 'EUR'),
27
                    'price' => array('8.00', 'EUR'),
28
                ),
29
            ),
30
            'total_count' => 3,
31
            'total_price' => array('10.00', 'EUR')
32
        );
33
34
        $order = new Order();
35
        $order
36
            ->setOrder($data)
37
            ->setFullname('Firstname Lastname')
38
            ->setPhone('0123456789')
39
            ->setEmail('[email protected]')
40
            ->setDate('Expected date')
41
        ;
42
43
        $manager->persist($order);
44
        $manager->flush();
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function getOrder()
51
    {
52
        return 3;
53
    }
54
}
55