Completed
Push — master ( df1f12...4872e5 )
by Lucas
05:42
created

LoadMultiLanguageData   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 80%
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 21
ccs 8
cts 10
cp 0.8
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 11 2
1
<?php
2
/**
3
 * /core/app fixtures for mongodb app collection.
4
 */
5
6
namespace Graviton\I18nBundle\DataFixtures\MongoDB;
7
8
use Doctrine\Common\DataFixtures\FixtureInterface;
9
use Doctrine\Common\Persistence\ObjectManager;
10
use Graviton\I18nBundle\Document\Language;
11
12
/**
13
 * Load Language data fixtures into mongodb
14
 *
15
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
16
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
17
 * @link     http://swisscom.ch
18
 */
19
class LoadMultiLanguageData implements FixtureInterface
20
{
21
    /**
22
     * {@inheritDoc}
23
     *
24
     * @param ObjectManager $manager Object Manager
25
     *
26
     * @return void
27
     */
28 42
    public function load(ObjectManager $manager)
29
    {
30 42
        foreach (['de' => 'German', 'fr' => 'French'] as $id => $name) {
31 42
            $lang = new Language;
32 42
            $lang->setId($id);
33 42
            $lang->setName($name);
34 42
            $manager->persist($lang);
35
        }
36
37 42
        $manager->flush();
38 42
    }
39
}
40