Load data fixtures with the passed EntityManager

@param ObjectManager $manager
324415
public function load(ObjectManager $manager)
    {
        $nodeRepository = $this->container->get('open_orchestra_model.repository.node');
        $nodes = $nodeRepository->findBy(array('nodeId' => NodeInterface::ROOT_NODE_ID, 'status.publishedState' => true));
        $updateRoute = $this->container->get('open_orchestra_backoffice.manager.route_document');

        foreach ($nodes as $node) {
            $routes = $updateRoute->createForNode($node);
            foreach ($routes as $route) {
                $manager->persist($route);
            }
        }

        $manager->flush();
    }
1329083
public function load(ObjectManager $manager)
    {
        /**
         * Carts.
         *
         * @var CartCouponInterface $cartCoupon
         * @var CartInterface       $cart
         * @var CouponInterface     $coupon
         */
        $cartCouponDirectory = $this->getDirector('cart_coupon');

        $cart = $this->getReference('full-cart');
        $coupon = $this->getReference('coupon-percent');

        $cartCoupon = $cartCouponDirectory
            ->create()
            ->setCart($cart)
            ->setCoupon($coupon);

        $cartCouponDirectory->save($cartCoupon);
        $this->addReference('cart-coupon', $cartCoupon);
    }
218237
public function getManager(?string $name = null) : ObjectManager
    {
        if ($name === null) {
            $name = $this->defaultManager;
        }

        if (! isset($this->managers[$name])) {
            throw new InvalidArgumentException(
                sprintf('Doctrine %s Manager named "%s" does not exist.', $this->name, $name)
            );
        }

        /** @var ObjectManager $objectManager */
        $objectManager = $this->getService($this->managers[$name]);

        return $objectManager;
    }
456959
public function load(ObjectManager $objectManager)
    {
        /**
         * @var ObjectDirector $zoneDirector
         */
        $zoneDirector = $this->getDirector('zone');

        $zone08021 = $zoneDirector
            ->create()
            ->setName('Postalcode 08021')
            ->setCode('zone-08021')
            ->addLocation($this->getReference('location-sant-celoni'))
            ->addLocation($this->getReference('location-08021'));

        $this->setReference('zone-08021', $zone08021);
        $zoneDirector->save($zone08021);

        $zoneViladecavalls = $zoneDirector
            ->create()
            ->setName('Viladecavalls i alrededores')
            ->setCode('zone-viladecavalls')
            ->addLocation($this->getReference('location-viladecavalls'));

        $this->setReference('zone-viladecavalls', $zoneViladecavalls);
        $zoneDirector->save($zoneViladecavalls);
    }
24519
public function scaffold(Manager $manager)
    {
        return new ObjectType(
            [
                'name' => $this->getTypeName(),
                'fields' => function () use ($manager) {
                    return $this->createFields($manager);
                },
            ]
        );
    }
1338428
protected function getObjectManager(ClassMetadata $metadata): ?ObjectManager
    {
        foreach ($this->managerRegistryCollection as $managerRegistry) {
            if ($objectManager = $managerRegistry->getManagerForClass($metadata->getName())) {
                return $objectManager;
            }
        }

        return null;
    }
1165062
public function buildEntityMapByObjectManagerName($objectManagerName)
    {
        $entityClassNames = $this->getEntityClassNamesByObjectManagerName($objectManagerName);

        $listEntityInterfaces = $this->buildListEntityInterfaces($entityClassNames);

        $map = [];

        $entityManager = $this->getEntityManager();
        foreach ($listEntityInterfaces as $currentInterface) {
            if ($entityManager->hasEntityClassByInterface($currentInterface)) {
                $map[$currentInterface] = $entityManager->getEntityClassByInterface($currentInterface);
            }
        }

        return $map;
    }
591724
public function load(ObjectManager $em) {
    foreach ($this->examples as $list) {
      list($example, $context) = $list;

      $fixture = new NestedSetFixture($example, $context);
      $fixture->load($em);
    }
  }
1260485
public function load(ObjectManager $manager)
    {
        $geocoder = new \HarvestCloud\GeoBundle\Util\GoogleGeocoder();

        $buyer = new User();
        $buyer->setEmail('harvest.cloud@example.com');
        $buyer->setFirstname('Harvest');
        $buyer->setLastname('Cloud');
        $buyer->setEnabled(false);
        $buyer->setPassword('');

        $buyerProfile = new Profile();
        $buyerProfile->setName($buyer->getFullname());

        $buyer->addProfile($buyerProfile);

        $location = new Location();
        $location->setName('Default');
        $location->setAddressLine1('150 Main Street');
        $location->setTown('Great Barrington');
        $location->setStateCode('MA');
        $location->setPostalCode('01230');

        $geocoder->geocode($location);

        $buyerProfile->addLocation($location);

        $exchange = $this->container->get('exchange_manager')->getExchange();

        $exchange->setProfile($buyerProfile);

        $manager->persist($exchange);
        $manager->persist($buyer);
        $manager->flush();


        $buyer = new User();
        $buyer->setEmail('craig.buyer@example.com');
        $buyer->setFirstname('Craig');
        $buyer->setLastname('Buyer');
        $buyer->setEnabled(true);

        $encoder = $this->container
            ->get('security.encoder_factory')
            ->getEncoder($buyer)
        ;

        $buyer->setPassword($encoder->encodePassword('buyer', $buyer->getSalt()));

        $buyerProfile = new Profile();
        $buyerProfile->setName($buyer->getFullname());

        $buyer->addProfile($buyerProfile);

        $location = new Location();
        $location->setName('Default');
        $location->setAddressLine1('250 Main Street');
        $location->setTown('Great Barrington');
        $location->setStateCode('MA');
        $location->setPostalCode('01230');

        $geocoder->geocode($location);

        $buyerProfile->addLocation($location);

        $manager->persist($buyer);
        $manager->flush();


        $buyer = new User();
        $buyer->setEmail('peter.buyer@example.com');
        $buyer->setFirstname('Peter');
        $buyer->setLastname('Buyer');
        $buyer->setEnabled(true);

        $encoder = $this->container
            ->get('security.encoder_factory')
            ->getEncoder($buyer)
        ;

        $buyer->setPassword($encoder->encodePassword('buyer', $buyer->getSalt()));

        $buyerProfile = new Profile();
        $buyerProfile->setName($buyer->getFullname());

        $buyer->addProfile($buyerProfile);

        $location = new Location();
        $location->setName('Default');
        $location->setAddressLine1('1 Main Street');
        $location->setTown('Sheffield');
        $location->setStateCode('MA');
        $location->setPostalCode('01257');

        $geocoder->geocode($location);

        $buyerProfile->addLocation($location);

        $manager->persist($buyer);
        $manager->flush();


        $buyer = new User();
        $buyer->setEmail('michael.buyer@example.com');
        $buyer->setFirstname('Michael');
        $buyer->setLastname('Buyer');
        $buyer->setEnabled(true);

        $encoder = $this->container
            ->get('security.encoder_factory')
            ->getEncoder($buyer)
        ;

        $buyer->setPassword($encoder->encodePassword('buyer', $buyer->getSalt()));

        $buyerProfile = new Profile();
        $buyerProfile->setName($buyer->getFullname());

        $buyer->addProfile($buyerProfile);

        $location = new Location();
        $location->setName('Default');
        $location->setAddressLine1('1 Main Street');
        $location->setTown('Lee');
        $location->setStateCode('MA');
        $location->setPostalCode('01238');

        $geocoder->geocode($location);

        $buyerProfile->addLocation($location);

        $manager->persist($buyer);
        $manager->flush();
    }
48487
public function load(ObjectManager $manager)
    {
        $howManyApps = 15;
        $createdCount = 0;

        while ($createdCount < $howManyApps) {
            $app = new App;
            $app->setId('app'.$createdCount);
            $app->setName('App'.$createdCount);
            $app->setShowInMenu(true);
            $app->setOrder($createdCount);

            $manager->persist($app);
            $createdCount++;
        }

        $manager->flush();
    }
1213023
public function load(ObjectManager $manager)
    {
        $gal = new Folder();
        $gal->setRel(Folder::TYPE_MEDIA);
        $gal->setName('Media');
        $gal->setTranslatableLocale('en');
        $manager->persist($gal);
        $manager->flush();
        $this->addReference('media-folder-en', $gal);

        $gal->setTranslatableLocale('nl');
        $manager->refresh($gal);
        $gal->setName('Media');
        $manager->persist($gal);
        $manager->flush();

        $gal->setTranslatableLocale('fr');
        $manager->refresh($gal);
        $gal->setName('Média');
        $manager->persist($gal);
        $manager->flush();

        $subgal = new Folder();
        $subgal->setParent($gal);
        $subgal->setRel(Folder::TYPE_IMAGE);
        $subgal->setName('Images');
        $subgal->setTranslatableLocale('en');
        $manager->persist($subgal);
        $manager->flush();
        $this->addReference('images-folder-en', $subgal);

        $subgal->setTranslatableLocale('nl');
        $manager->refresh($subgal);
        $subgal->setName('Afbeeldingen');
        $manager->persist($subgal);
        $manager->flush();

        $subgal->setTranslatableLocale('fr');
        $manager->refresh($subgal);
        $subgal->setName('Images');
        $manager->persist($subgal);
        $manager->flush();

        $subgal = new Folder();
        $subgal->setParent($gal);
        $subgal->setRel(Folder::TYPE_FILES);
        $subgal->setName('Files');
        $subgal->setTranslatableLocale('en');
        $manager->persist($subgal);
        $manager->flush();
        $this->addReference('files-folder-en', $subgal);

        $subgal->setTranslatableLocale('nl');
        $manager->refresh($subgal);
        $subgal->setName('Bestanden');
        $manager->persist($subgal);
        $manager->flush();

        $subgal->setTranslatableLocale('fr');
        $manager->refresh($subgal);
        $subgal->setName('Fichiers');
        $manager->persist($subgal);
        $manager->flush();

        $subgal = new Folder();
        $subgal->setParent($gal);
        $subgal->setRel(Folder::TYPE_SLIDESHOW);
        $subgal->setName('Slides');
        $subgal->setTranslatableLocale('en');
        $manager->persist($subgal);
        $manager->flush();
        $this->addReference('slides-folder-en', $subgal);

        $subgal->setTranslatableLocale('nl');
        $manager->refresh($subgal);
        $subgal->setName('Presentaties');
        $manager->persist($subgal);
        $manager->flush();

        $subgal->setTranslatableLocale('fr');
        $manager->refresh($subgal);
        $subgal->setName('Presentations');
        $manager->persist($subgal);
        $manager->flush();

        $subgal = new Folder();
        $subgal->setParent($gal);
        $subgal->setRel(Folder::TYPE_VIDEO);
        $subgal->setName('Videos');
        $subgal->setTranslatableLocale('en');
        $manager->persist($subgal);
        $manager->flush();
        $this->addReference('videos-folder-en', $subgal);

        $subgal->setTranslatableLocale('nl');
        $manager->refresh($subgal);
        $subgal->setName('Video\'s');
        $manager->persist($subgal);
        $manager->flush();

        $subgal->setTranslatableLocale('fr');
        $manager->refresh($subgal);
        $subgal->setName('Vidéos');
        $manager->persist($subgal);
        $manager->flush();
    }
1221116
public function load(ObjectManager $manager)
    {
        $product = new Product();
        $product->setName('Lovely Eggs');
        $product->setCategory($this->getReference('eggs-category'));
        $product->setSeller($this->getReference('jon-seller'));
        $product->setInitialQuantity(10);
        $product->setPrice('5.00');

        $manager->persist($product);
        $manager->flush();


        $product = new Product();
        $product->setName('Tomatoes');
        $product->setCategory($this->getReference('tomatoes-category'));
        $product->setSeller($this->getReference('jon-seller'));
        $product->setInitialQuantity(7);
        $product->setPrice('3.85');

        $manager->persist($product);
        $manager->flush();


        $product = new Product();
        $product->setName('Suh-weet Potatoes');
        $product->setCategory($this->getReference('sweet-potatoes-category'));
        $product->setSeller($this->getReference('tom-seller'));
        $product->setInitialQuantity(12);
        $product->setPrice('2.75');

        $manager->persist($product);
        $manager->flush();


        $product = new Product();
        $product->setName('Tom\'s Toms');
        $product->setCategory($this->getReference('tomatoes-category'));
        $product->setSeller($this->getReference('tom-seller'));
        $product->setInitialQuantity(8);
        $product->setPrice('4.75');

        $manager->persist($product);
        $manager->flush();


        $product = new Product();
        $product->setName('Apples');
        $product->setCategory($this->getReference('apples-category'));
        $product->setSeller($this->getReference('jo-seller'));
        $product->setInitialQuantity(13);
        $product->setPrice('5.05');

        $manager->persist($product);
        $manager->flush();


        $product = new Product();
        $product->setName('Sweet Potatoes');
        $product->setCategory($this->getReference('sweet-potatoes-category'));
        $product->setSeller($this->getReference('jo-seller'));
        $product->setInitialQuantity(13);
        $product->setPrice('2.65');

        $manager->persist($product);
        $manager->flush();


        $product = new Product();
        $product->setName('Carrots');
        $product->setCategory($this->getReference('carrots-category'));
        $product->setSeller($this->getReference('jo-seller'));
        $product->setInitialQuantity(15);
        $product->setPrice('2.95');

        $manager->persist($product);
        $manager->flush();


        $product = new Product();
        $product->setName('Onions');
        $product->setCategory($this->getReference('onions-category'));
        $product->setSeller($this->getReference('sterling-seller'));
        $product->setInitialQuantity(11);
        $product->setPrice('2.95');

        $manager->persist($product);
        $manager->flush();


        $product = new Product();
        $product->setName('Ca-ca-carrots');
        $product->setCategory($this->getReference('carrots-category'));
        $product->setSeller($this->getReference('sterling-seller'));
        $product->setInitialQuantity(1);
        $product->setPrice('2.90');

        $manager->persist($product);
        $manager->flush();


        $product = new Product();
        $product->setName('Apples');
        $product->setCategory($this->getReference('apples-category'));
        $product->setSeller($this->getReference('sterling-seller'));
        $product->setInitialQuantity(11);
        $product->setPrice('4.15');

        $manager->persist($product);
        $manager->flush();


        $product = new Product();
        $product->setName('Them Apples');
        $product->setCategory($this->getReference('apples-category'));
        $product->setSeller($this->getReference('tom-seller'));
        $product->setInitialQuantity(11);
        $product->setPrice('4.25');

        $manager->persist($product);
        $manager->flush();


        $product = new Product();
        $product->setName('Delicious Eggs');
        $product->setCategory($this->getReference('eggs-category'));
        $product->setSeller($this->getReference('tom-seller'));
        $product->setInitialQuantity(8);
        $product->setPrice('5.25');

        $manager->persist($product);
        $manager->flush();


        $product = new Product();
        $product->setName('Yummy Eggs');
        $product->setCategory($this->getReference('eggs-category'));
        $product->setSeller($this->getReference('stephen-seller'));
        $product->setInitialQuantity(11);
        $product->setPrice('4.95');

        $manager->persist($product);
        $manager->flush();


        $product = new Product();
        $product->setName('Milk');
        $product->setCategory($this->getReference('milk-category'));
        $product->setSeller($this->getReference('jon-seller'));
        $product->setInitialQuantity(8);
        $product->setPrice('3.55');

        $manager->persist($product);
        $manager->flush();


        $product = new Product();
        $product->setName('Milk');
        $product->setCategory($this->getReference('milk-category'));
        $product->setSeller($this->getReference('stephen-seller'));
        $product->setInitialQuantity(10);
        $product->setPrice('3.45');

        $manager->persist($product);
        $manager->flush();
    }
666071
public function load(ObjectManager $manager)
    {
        $translator = $this->container->get('translator');
        $infoName = $translator->trans('informations', array(), 'platform');

        $desktopHomeTab = new HomeTab();
        $desktopHomeTab->setType('admin_desktop');
        $desktopHomeTab->setName($infoName);
        $manager->persist($desktopHomeTab);

        $desktopHomeTabConfig = new HomeTabConfig();
        $desktopHomeTabConfig->setHomeTab($desktopHomeTab);
        $desktopHomeTabConfig->setType('admin_desktop');
        $desktopHomeTabConfig->setVisible(true);
        $desktopHomeTabConfig->setLocked(false);
        $desktopHomeTabConfig->setTabOrder(1);
        $manager->persist($desktopHomeTabConfig);

        $workspaceHomeTab = new HomeTab();
        $workspaceHomeTab->setType('admin_workspace');
        $workspaceHomeTab->setName($infoName);
        $manager->persist($workspaceHomeTab);

        $workspaceHomeTabConfig = new HomeTabConfig();
        $workspaceHomeTabConfig->setHomeTab($workspaceHomeTab);
        $workspaceHomeTabConfig->setType('admin_workspace');
        $workspaceHomeTabConfig->setVisible(true);
        $workspaceHomeTabConfig->setLocked(false);
        $workspaceHomeTabConfig->setTabOrder(1);
        $manager->persist($workspaceHomeTabConfig);
    }
1234527
public function init(ModuleManagerInterface $manager)
    {
        $serviceManager = $manager->getEvent()->getParam('ServiceManager');
        if ($serviceManager->get(Environment::class)->is(self::ENVIRONMENT_CLI)) {
            $manager->getEventManager()->attach(
                ModuleEvent::EVENT_LOAD_MODULES_POST,
                [$this, 'addCliConfig'],
                PHP_INT_MAX
            );
        }
        $manager->getEventManager()->attach(ModuleEvent::EVENT_MERGE_CONFIG, [$this, 'onMergeConfig']);
    }
982437
protected function decorateManager(array $settings = [], EntityManagerInterface $manager)
    {
        if ($decorator = Arr::get($settings, 'decorator', false)) {
            if (!class_exists($decorator)) {
                throw new InvalidArgumentException("EntityManagerDecorator {$decorator} does not exist");
            }

            $manager = new $decorator($manager);
        }

        return $manager;
    }
998935
public function load(ObjectManager $manager)
    {
        /**
         * @var ObjectDirector $configurationDirector
         */
        $configurationDirector = $this->getDirector('configuration');

        /**
         * Parameter.
         */
        $parameter = $configurationDirector
            ->create()
            ->setKey('my_boolean_parameter')
            ->setNamespace('app')
            ->setName('My Fixtures Boolean Parameter')
            ->setValue(true)
            ->setType('boolean');

        $configurationDirector->save($parameter);
    }
169134
public function load(ObjectManager $manager)
    {
        /**
         * @var ProductInterface  $productWithVariants
         * @var CurrencyInterface $currency
         * @var ObjectDirector    $variantDirector
         */
        $currency = $this->getReference('currency-dollar');
        $productWithVariants = $this->getReference('product-with-variants');
        $variantDirector = $this->getDirector('product_variant');

        /**
         * @var ValueInterface $optionWhite
         * @var ValueInterface $optionRed
         * @var ValueInterface $optionSmall
         * @var ValueInterface $optionLarge
         */
        $optionWhite = $this->getReference('value-color-white');
        $optionRed = $this->getReference('value-color-red');
        $optionSmall = $this->getReference('value-size-small');
        $optionLarge = $this->getReference('value-size-large');

        /**
         * Variant White-Small.
         */
        $variantWhiteSmall = $variantDirector
            ->create()
            ->setSku('variant-white-small-sku')
            ->setStock(100)
            ->setProduct($productWithVariants)
            ->addOption($optionWhite)
            ->addOption($optionSmall)
            ->setPrice(Money::create(1500, $currency))
            ->setHeight(13)
            ->setWidth(12)
            ->setDepth(19)
            ->setWeight(125)
            ->setEnabled(true);

        $productWithVariants->setPrincipalVariant($variantWhiteSmall);

        $variantDirector->save($variantWhiteSmall);
        $this->addReference('variant-white-small', $variantWhiteSmall);

        /**
         * Variant White-Large.
         */
        $variantWhiteLarge = $variantDirector
            ->create()
            ->setSku('variant-white-large-sku')
            ->setStock(100)
            ->setProduct($productWithVariants)
            ->addOption($optionWhite)
            ->addOption($optionLarge)
            ->setPrice(Money::create(1800, $currency))
            ->setHeight(12)
            ->setWidth(11)
            ->setDepth(45)
            ->setWeight(155)
            ->setEnabled(true);

        $variantDirector->save($variantWhiteLarge);
        $this->addReference('variant-white-large', $variantWhiteLarge);

        /**
         * Variant Red-Small.
         */
        $variantRedSmall = $variantDirector
            ->create()
            ->setSku('variant-red-small-sku')
            ->setStock(100)
            ->setProduct($productWithVariants)
            ->addOption($optionRed)
            ->addOption($optionSmall)
            ->setPrice(Money::create(1500, $currency))
            ->setHeight(19)
            ->setWidth(9)
            ->setDepth(33)
            ->setWeight(1000)
            ->setEnabled(true);

        $this->storeProductImage(
            $variantRedSmall,
            'variant.jpg'
        );

        $variantDirector->save($variantRedSmall);
        $this->addReference('variant-red-small', $variantRedSmall);

        /**
         * Variant Red-Large.
         */
        $variantRedLarge = $variantDirector
            ->create()
            ->setSku('variant-red-large-sku')
            ->setStock(100)
            ->setProduct($productWithVariants)
            ->addOption($optionRed)
            ->addOption($optionLarge)
            ->setPrice(Money::create(1800, $currency))
            ->setHeight(50)
            ->setWidth(30)
            ->setDepth(18)
            ->setWeight(70)
            ->setEnabled(true);

        $variantDirector->save($variantRedLarge);
        $this->addReference('variant-red-large', $variantRedLarge);
    }