Completed
Push — feature/EVO-7964_fundInfo-exte... ( cf9459...eda009 )
by Bastian
15:13 queued 08:52
created

LoadAppDataExceedSinglePageLimit::load()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 18
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 18
ccs 0
cts 15
cp 0
rs 9.4285
cc 2
eloc 12
nc 2
nop 1
crap 6
1
<?php
2
/**
3
 * /core/app fixtures for mongodb app collection, exceeding one page size.
4
 */
5
6
namespace Graviton\CoreBundle\DataFixtures\MongoDB;
7
8
use Doctrine\Common\DataFixtures\FixtureInterface;
9
use Doctrine\Common\Persistence\ObjectManager;
10
use Graviton\CoreBundle\Document\App;
11
12
/**
13
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
14
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
15
 * @link     http://swisscom.ch
16
 */
17
class LoadAppDataExceedSinglePageLimit implements FixtureInterface
18
{
19
    /**
20
     * {@inheritDoc}
21
     *
22
     * @param ObjectManager $manager Object Manager
23
     *
24
     * @return void
25
     */
26
    public function load(ObjectManager $manager)
27
    {
28
        $howManyApps = 15;
29
        $createdCount = 0;
30
31
        while ($createdCount < $howManyApps) {
32
            $app = new App;
33
            $app->setId('app'.$createdCount);
34
            $app->setName('App'.$createdCount);
35
            $app->setShowInMenu(true);
36
            $app->setOrder($createdCount);
37
38
            $manager->persist($app);
39
            $createdCount++;
40
        }
41
42
        $manager->flush();
43
    }
44
}
45