Completed
Push — Recipes ( 43b996...9c2236 )
by Laurent
03:16
created

LoadAppData::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 19
nc 1
nop 1
dl 0
loc 28
rs 9.6333
c 0
b 0
f 0
1
<?php
2
/**
3
 * LoadAppData Données de l'application GLSR.
4
 *
5
 * PHP Version 7
6
 *
7
 * @author    Quétier Laurent <[email protected]>
8
 * @copyright 2018 Dev-Int GLSR
9
 * @license   http://opensource.org/licenses/gpl-license.php GNU Public License
10
 *
11
 * @version GIT: $Id$
12
 *
13
 * @see https://github.com/Dev-Int/glsr
14
 */
15
16
namespace App\DataFixtures;
17
18
use Doctrine\Bundle\FixturesBundle\Fixture;
19
use Doctrine\Common\Persistence\ObjectManager;
20
use App\Entity\Settings\Company;
21
use App\Entity\Settings\Settings;
22
23
/**
24
 * LoadApp Data.
25
 *
26
 * @category DataFixtures
27
 */
28
class LoadAppData extends Fixture
29
{
30
    /**
31
     * Load data fixtures with the passed EntityManager.
32
     *
33
     * @param ObjectManager $manager
34
     */
35
    public function load(ObjectManager $manager)
36
    {
37
        $phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance();
38
39
        // Load Company
40
        $app = new Company();
41
        $app->setName('Dev-Int')
42
            ->setStatus('S.A.R.L.')
43
            ->setAddress('2, rue de la chèvre')
44
            ->setZipCode('75000')
45
            ->setTown('Paris')
46
            ->setPhone($phoneUtil->parse('0140000000', 'FR'))
47
            ->setFax($phoneUtil->parse('0140000000', 'FR'))
48
            ->setEmail('[email protected]')
49
            ->setContact('Ursule')
50
            ->setGsm($phoneUtil->parse('0640000000', 'FR'));
51
52
        $manager->persist($app);
53
54
        // Load Settings
55
        $settings = new Settings();
56
        $settings->setInventoryStyle('zonestorage')
57
            ->setCalculation('weighted')
58
            ->setCurrency('EUR');
59
60
        $manager->persist($settings);
61
62
        $manager->flush();
63
    }
64
}
65