Completed
Push — master ( 4b2b7c...0f3ee7 )
by Benjamin
02:12
created

LoadMenuData::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 15
rs 9.4285
cc 1
eloc 11
nc 1
nop 1
1
<?php
2
3
namespace Alpixel\Bundle\MenuBundle\DataFixtures\ORM;
4
5
use Alpixel\Bundle\MenuBundle\Entity\Menu;
6
use Alpixel\Bundle\MenuBundle\Entity\MenuItem;
7
use Doctrine\Common\DataFixtures\AbstractFixture;
8
use Doctrine\Common\DataFixtures\FixtureInterface;
9
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
10
use Doctrine\Common\Persistence\ObjectManager;
11
12
class LoadMenuData extends AbstractFixture implements FixtureInterface, OrderedFixtureInterface
13
{
14
    function load(ObjectManager $objectManager)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
15
    {
16
	$menu = new Menu;
17
	$menu->setMachineName('main');
18
	$menu->setName('Menu principal');
19
20
	$item = new MenuItem;
21
	$item->setUri('/');
22
	$item->setName('Homepage');
23
	$menu->addItem($item);
0 ignored issues
show
Bug introduced by
The method addItem() does not exist on Alpixel\Bundle\MenuBundle\Entity\Menu. Did you maybe mean addItems()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
24
25
        $manager->persist($item);
0 ignored issues
show
Bug introduced by
The variable $manager does not exist. Did you mean $objectManager?

This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.

The variable may have been renamed without also renaming all references.

Loading history...
26
	$manager->persist($menu);
0 ignored issues
show
Bug introduced by
The variable $manager does not exist. Did you mean $objectManager?

This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.

The variable may have been renamed without also renaming all references.

Loading history...
27
        $manager->flush();
0 ignored issues
show
Bug introduced by
The variable $manager does not exist. Did you mean $objectManager?

This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.

The variable may have been renamed without also renaming all references.

Loading history...
28
    }
29
30
    public function getOrder()
31
    {
32
        return 0;
33
    }
34
}
35