Load address types

@param \Doctrine\Common\Persistence\ObjectManager $manager
345896
public function load(ObjectManager $manager)
    {
        $theme = new Theme();
        $theme->setTitle('Theme 1');
        $theme->setImage('/theme/images/screenshots/1-Penguins.jpg');
        $theme->setArea('admin');
        $theme->setPackage('default');
        $theme->setTheme('base');
        $manager->persist($theme);

        $theme = new Theme();
        $theme->setTitle('Theme 2');
        $theme->setImage('/theme/images/screenshots/2-Desert.jpg');
        $theme->setArea('admin');
        $theme->setPackage('default');
        $theme->setTheme('demo');
        $manager->persist($theme);
        $theme->setIsActive(1);
        $manager->persist($theme);

        $theme = new Theme();
        $theme->setTitle('Theme 3');
        $theme->setImage('/theme/images/screenshots/3-Tulips.jpg');
        $theme->setArea('frontend');
        $theme->setPackage('default');
        $theme->setTheme('base');
        $manager->persist($theme);

        $theme = new Theme();
        $theme->setTitle('Theme 4');
        $theme->setImage('/theme/images/screenshots/4-Koala.jpg');
        $theme->setArea('frontend');
        $theme->setPackage('default');
        $theme->setTheme('demo');
        $manager->persist($theme);
        $theme->setIsActive(1);
        $manager->persist($theme);

        $manager->flush();
    }
1046447
public function addToManager(Manager $manager)
    {
        $this->extend('onBeforeAddToManager', $manager);
        $scaffold = $this->scaffold($manager);
        if (!$manager->hasType($this->getTypeName())) {
            $manager->addType($scaffold, $this->getTypeName());
        }

        foreach ($this->operations as $op) {
            $op->addToManager($manager);
        }

        foreach ($this->nestedQueries as $scaffold) {
            $scaffold->addToManager($manager);
        }

        $this->extend('onAfterAddToManager', $manager);
    }
861997
public function load(ObjectManager $manager)
    {
        $gal = new Folder($manager);
        $gal->setName('Media');
        $gal->setTranslatableLocale('en');
        $gal->setRel('media');
        $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('Media');
        $manager->persist($gal);
        $manager->flush();

        $subgal = new Folder($manager);
        $subgal->setParent($gal);
        $subgal->setName('Images');
        $subgal->setTranslatableLocale('en');
        $subgal->setRel('image');
        $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($manager);
        $subgal->setParent($gal);
        $subgal->setName('Videos');
        $subgal->setTranslatableLocale('en');
        $subgal->setRel('video');
        $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();

        $subgal = new Folder($manager);
        $subgal->setParent($gal);
        $subgal->setName('Slides');
        $subgal->setTranslatableLocale('en');
        $subgal->setRel('slideshow');
        $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($manager);
        $subgal->setParent($gal);
        $subgal->setName('Files');
        $subgal->setTranslatableLocale('en');
        $subgal->setRel('files');
        $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();
    }
403614
public function getLoader(ObjectManager $manager, $queryBuilder, $class, $hints = [])
    {
        $loader = new ORMQueryBuilderLoader($queryBuilder, $manager, $class);

        foreach ($hints as $name => $value) {
            $loader->setHint($name, $value);
        }

        return $loader;
    }
1092134
public function load(ObjectManager $manager)
    {
        $data = [
            [
                'language' => 'de',
                'original' => 'German',
                'localized' => 'Deutsch'
            ],
            [
                'language' => 'de',
                'original' => 'English',
                'localized' => 'Englisch'
            ],
            [
                'language' => 'fr',
                'original' => 'English',
                'localized' => 'Anglais'
            ],
            [
                'language' => 'es',
                'original' => 'English',
                'localized' => 'Inglés'
            ]
        ];

        foreach ($data as $record) {
            $translation = new Translation();
            $translation->setLanguage($record['language']);
            $translation->setOriginal($record['original']);
            $translation->setLocalized($record['localized']);
            $manager->persist($translation);
            $manager->flush();
        }
    }
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);
    }
51203
protected function registerMappingDrivers($objectManager, ContainerBuilder $container)
    {
        // configure metadata driver for each bundle based on the type of mapping files found
        if ($container->hasDefinition($this->getObjectManagerElementName($objectManager['name'].'_metadata_driver'))) {
            $chainDriverDef = $container->getDefinition($this->getObjectManagerElementName($objectManager['name'].'_metadata_driver'));
        } else {
            $chainDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.driver_chain.class%'));
            $chainDriverDef->setPublic(false);
        }

        foreach ($this->drivers as $driverType => $driverPaths) {
            $mappingService = $this->getObjectManagerElementName($objectManager['name'].'_'.$driverType.'_metadata_driver');
            if ($container->hasDefinition($mappingService)) {
                $mappingDriverDef = $container->getDefinition($mappingService);
                $args = $mappingDriverDef->getArguments();
                if ('annotation' == $driverType) {
                    $args[1] = array_merge(array_values($driverPaths), $args[1]);
                } else {
                    $args[0] = array_merge(array_values($driverPaths), $args[0]);
                }
                $mappingDriverDef->setArguments($args);
            } elseif ('annotation' == $driverType) {
                $mappingDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'), [
                    new Reference($this->getObjectManagerElementName('metadata.annotation_reader')),
                    array_values($driverPaths),
                ]);
            } else {
                $mappingDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'), [
                    array_values($driverPaths),
                ]);
            }
            $mappingDriverDef->setPublic(false);
            if (false !== strpos($mappingDriverDef->getClass(), 'yml') || false !== strpos($mappingDriverDef->getClass(), 'xml')) {
                $mappingDriverDef->setArguments([array_flip($driverPaths)]);
                $mappingDriverDef->addMethodCall('setGlobalBasename', ['mapping']);
            }

            $container->setDefinition($mappingService, $mappingDriverDef);

            foreach ($driverPaths as $prefix => $driverPath) {
                $chainDriverDef->addMethodCall('addDriver', [new Reference($mappingService), $prefix]);
            }
        }

        $container->setDefinition($this->getObjectManagerElementName($objectManager['name'].'_metadata_driver'), $chainDriverDef);
    }
435039
public function load(ObjectManager $manager)
    {
        $roles = $manager->getRepository('ClarolineCoreBundle:Role')
            ->findAllPlatformRoles();

        //name, isConfigurable, isDisplayableInDesktop, isDisplayableInWorkspace
        $items = array(
            array('core_resource_logger', true, true, true),
            array('simple_text', true, true, true),
            array('my_workspaces', false, true, false),
            array('my_profile', false, true, false),
        );

        foreach ($items as $item) {
            $widget = new Widget();
            $widget->setName($item[0]);
            $widget->setConfigurable($item[1]);
            $widget->setPlugin(null);
            $widget->setExportable(false);
            $widget->setDisplayableInDesktop($item[2]);
            $widget->setDisplayableInWorkspace($item[3]);

            foreach ($roles as $role) {
                $widget->addRole($role);
            }
            $manager->persist($widget);
        }
    }
742154
public function load(ObjectManager $manager)
    {
        /**
         * Pack.
         *
         * @var CategoryInterface     $category
         * @var ManufacturerInterface $manufacturer
         * @var CurrencyInterface     $currency
         * @var ObjectDirector        $packDirector
         */
        $category = $this->getReference('category');
        $manufacturer = $this->getReference('manufacturer');
        $product = $this->getReference('product');
        $productReduced = $this->getReference('product-reduced');
        $variant = $this->getReference('variant-red-small');
        $currency = $this->getReference('currency-dollar');
        $packDirector = $this->getDirector('purchasable_pack');

        // Id assigned = 9
        $pack = $packDirector
            ->create()
            ->setName('pack')
            ->setSlug('pack')
            ->setDescription('my pack description')
            ->setShortDescription('my pack short description')
            ->addCategory($category)
            ->setPrincipalCategory($category)
            ->setManufacturer($manufacturer)
            ->addPurchasable($product)
            ->addPurchasable($productReduced)
            ->addPurchasable($variant)
            ->setStockType(ElcodiProductStock::SPECIFIC_STOCK)
            ->setStock(10)
            ->setPrice(Money::create(5000, $currency))
            ->setSku('pack-sku-code-1')
            ->setHeight(30)
            ->setWidth(30)
            ->setDepth(30)
            ->setWeight(200)
            ->setEnabled(true);

        $packDirector->save($pack);
        $this->addReference('pack', $pack);

        // Id assigned = 10
        $packInherit = $packDirector
            ->create()
            ->setName('pack-inherit')
            ->setSlug('pack-inherit')
            ->setDescription('my pack inherit description')
            ->setShortDescription('my pack inherit short description')
            ->addCategory($category)
            ->setPrincipalCategory($category)
            ->setManufacturer($manufacturer)
            ->addPurchasable($product)
            ->addPurchasable($productReduced)
            ->addPurchasable($variant)
            ->setStockType(ElcodiProductStock::INHERIT_STOCK)
            ->setPrice(Money::create(5000, $currency))
            ->setSku('pack-inherit-sku-code-1')
            ->setHeight(30)
            ->setWidth(30)
            ->setDepth(30)
            ->setWeight(200)
            ->setEnabled(true);

        $this->storeProductImage(
            $packInherit,
            'pack.jpg'
        );

        $packDirector->save($packInherit);
        $this->addReference('pack-inherit', $packInherit);
    }
116226
public function load(ObjectManager $manager)
    {
        /**
         * Product.
         *
         * @var CategoryInterface     $category
         * @var ManufacturerInterface $manufacturer
         * @var CurrencyInterface     $currency
         * @var ObjectDirector        $productDirector
         */
        $category = $this->getReference('category');
        $rootCategory = $this->getReference('rootCategory');
        $manufacturer = $this->getReference('manufacturer');
        $currency = $this->getReference('currency-dollar');
        $productDirector = $this->getDirector('product');

        $product = $productDirector
            ->create()
            ->setName('product')
            ->setSlug('product')
            ->setDescription('my product description')
            ->setShortDescription('my product short description')
            ->addCategory($category)
            ->setPrincipalCategory($category)
            ->setManufacturer($manufacturer)
            ->setStock(10)
            ->setPrice(Money::create(1000, $currency))
            ->setSku('product-sku-code-1')
            ->setHeight(10)
            ->setWidth(15)
            ->setDepth(20)
            ->setWeight(100)
            ->setEnabled(true);

        $productDirector->save($product);
        $this->addReference('product', $product);

        /**
         * Reduced Product.
         */
        $productReduced = $productDirector
            ->create()
            ->setName('product-reduced')
            ->setSlug('product-reduced')
            ->setDescription('my product-reduced description')
            ->setShortDescription('my product-reduced short description')
            ->setShowInHome(true)
            ->setStock(5)
            ->setPrice(Money::create(1000, $currency))
            ->setReducedPrice(Money::create(500, $currency))
            ->setHeight(25)
            ->setWidth(30)
            ->setDepth(35)
            ->setWeight(200)
            ->setEnabled(true);

        $this->storeProductImage(
            $productReduced,
            'product.jpg'
        );

        $productDirector->save($productReduced);
        $this->addReference('product-reduced', $productReduced);

        /**
         * Product with variants.
         *
         * @var ProductInterface $productWithVariants
         */
        $productWithVariants = $productDirector
            ->create()
            ->setName('Product with variants')
            ->setSku('product-sku-code-variant-1')
            ->setSlug('product-with-variants')
            ->setDescription('my product with variants description')
            ->setShortDescription('my product with variants short description')
            ->addCategory($category)
            ->setPrincipalCategory($category)
            ->setManufacturer($manufacturer)
            ->setStock(10)
            ->setPrice(Money::create(1000, $currency))
            ->setHeight(40)
            ->setWidth(45)
            ->setDepth(50)
            ->setWeight(500)
            ->setEnabled(true);

        $productDirector->save($productWithVariants);
        $this->addReference('product-with-variants', $productWithVariants);

        /**
         * Root category product.
         *
         * @var ProductInterface $rootCategoryProduct
         */
        $rootCategoryProduct = $productDirector
            ->create()
            ->setName('Root category product')
            ->setSlug('root-category-product')
            ->setDescription('my product description')
            ->setShortDescription('my product short description')
            ->addCategory($rootCategory)
            ->setPrincipalCategory($rootCategory)
            ->setManufacturer($manufacturer)
            ->setStock(10)
            ->setPrice(Money::create(500, $currency))
            ->setSku('product-sku-code-3')
            ->setHeight(10)
            ->setWidth(15)
            ->setDepth(20)
            ->setWeight(100)
            ->setEnabled(true);

        $productDirector->save($rootCategoryProduct);
        $this->addReference('rootCategoryProduct', $rootCategoryProduct);
    }
12794
public function load(ObjectManager $manager)
    {
        /**
         * @var ObjectDirector $manufacturerDirector
         */
        $manufacturerDirector = $this->getDirector('manufacturer');

        $manufacturer = $manufacturerDirector
            ->create()
            ->setName('manufacturer')
            ->setSlug('manufacturer')
            ->setDescription('manufacturer description');

        $manufacturerDirector->save($manufacturer);
        $this->addReference('manufacturer', $manufacturer);
    }
125985
public function load(ObjectManager $manager)
    {
        $role1 = $this->createRole($manager, 'ROLE_PERMISSIONMANAGER');
        $role2 = $this->createRole($manager, 'ROLE_ADMIN');
        $role3 = $this->createRole($manager, 'ROLE_SUPER_ADMIN');
        $role4 = $this->createRole($manager, 'IS_AUTHENTICATED_ANONYMOUSLY');

        $manager->flush();

        $this->addReference(self::REFERENCE_PERMISSIONMANAGER_ROLE, $role1);
        $this->addReference(self::REFERENCE_ADMIN_ROLE, $role2);
        $this->addReference(self::REFERENCE_SUPERADMIN_ROLE, $role3);
        $this->addReference(self::REFERENCE_GUEST_ROLE, $role4);
    }
1261818
public function load(ObjectManager $manager, FixtureInterface $fixture)
    {
        if ($this->logger) {
            $prefix = '';
            if ($fixture instanceof OrderedFixtureInterface) {
                $prefix = sprintf('[%d] ',$fixture->getOrder());
            }
            $this->log('loading ' . $prefix . get_class($fixture));
        }
        // additionally pass the instance of reference repository to shared fixtures
        if ($fixture instanceof SharedFixtureInterface) {
            $fixture->setReferenceRepository($this->referenceRepository);
        }
        $fixture->load($manager);
        $manager->clear();
    }
788408
public function addToManager(Manager $manager)
    {
        $this->registerFixedTypes($manager);
        $this->registerPeripheralTypes($manager);

        $this->extend('onBeforeAddToManager', $manager);

        // Add all DataObjects to the manager
        foreach ($this->types as $scaffold) {
            $scaffold->addToManager($manager);
            $inheritanceScaffolder = new InheritanceScaffolder(
                $scaffold->getDataObjectClass(),
                StaticSchema::config()->get('inheritanceTypeSuffix')
            );
            // Due to shared ancestry, it's inevitable that the same union type will get added multiple times.
            if (!$manager->hasType($inheritanceScaffolder->getName())) {
                $inheritanceScaffolder->addToManager($manager);
            }
        }

        foreach ($this->queries as $scaffold) {
            $scaffold->addToManager($manager);
        }

        foreach ($this->mutations as $scaffold) {
            $scaffold->addToManager($manager);
        }

        $this->extend('onAfterAddToManager', $manager);
    }
1127575
public function load(ObjectManager $manager)
    {
        /**
         * @var ObjectDirector $categoryDirector
         */
        $categoryDirector = $this->getDirector('category');

        /**
         * Category.
         *
         * @var CategoryInterface $rootCategory
         */
        $rootCategory = $categoryDirector
            ->create()
            ->setName('root-category')
            ->setSlug('root-category')
            ->setEnabled(true)
            ->setRoot(true);

        $categoryDirector->save($rootCategory);
        $this->addReference('rootCategory', $rootCategory);

        /**
         * Category.
         *
         * @var CategoryInterface $category
         */
        $category = $categoryDirector
            ->create()
            ->setName('category')
            ->setSlug('category')
            ->setEnabled(true)
            ->setParent($rootCategory)
            ->setRoot(false);

        $categoryDirector->save($category);
        $this->addReference('category', $category);

        /**
         * Second level category.
         *
         * @var CategoryInterface $secondLevelCategory
         */
        $secondLevelCategory = $categoryDirector
            ->create()
            ->setName('Second level category')
            ->setSlug('second-level-category')
            ->setEnabled(true)
            ->setParent($category)
            ->setRoot(false);

        $categoryDirector->save($secondLevelCategory);
        $this->addReference('secondLevelCategory', $secondLevelCategory);
    }
741745
public function load(ObjectManager $manager)
    {
        $user = new User();
        $user->setFirstname('admin');
        $user->setFirstname('admin');
        $user->setUsername('admin');
        $user->setEmail('admin@test.com');
        $user->setState(1);

        $newPass = 'playground';

        $bcrypt = new Bcrypt;
        $bcrypt->setCost(14);

        $pass = $bcrypt->create($newPass);
        $user->setPassword($pass);

        $user->addRole(
            $this->getReference('admin-role') // load the stored reference
        );

        $manager->persist($user);

        $manager->flush();

        $user = new User();
        $user->setFirstname('supervisor');
        $user->setFirstname('supervisor');
        $user->setUsername('supervisor');
        $user->setEmail('supervisor@test.com');
        $user->setState(1);

        $newPass = 'playground';

        $bcrypt = new Bcrypt;
        $bcrypt->setCost(14);

        $pass = $bcrypt->create($newPass);
        $user->setPassword($pass);

        $user->addRole(
            $this->getReference('supervisor-role') // load the stored reference
        );

        $manager->persist($user);

        $manager->flush();

        $user = new User();
        $user->setFirstname('game-manager');
        $user->setFirstname('game-manager');
        $user->setUsername('gamemanager');
        $user->setEmail('game-manager@test.com');
        $user->setState(1);

        $newPass = 'playground';

        $bcrypt = new Bcrypt;
        $bcrypt->setCost(14);

        $pass = $bcrypt->create($newPass);
        $user->setPassword($pass);

        $user->addRole(
            $this->getReference('game-role') // load the stored reference
        );

        $manager->persist($user);

        $manager->flush();
    }
1255653
public function init( ModuleManagerInterface $manager )
    {
        $this->moduleManager  = $manager;
        $this->serviceLocator = $manager->getEvent()
                                        ->getParam( 'ServiceManager' );

        $shared = $manager->getEventManager()
                          ->getSharedManager();

        $shared->attach(
            'Zend\Stdlib\DispatchableInterface',
            MvcEvent::EVENT_DISPATCH,
            array( new InjectTemplateListener, 'injectTemplate' ),
            -85
        );

        $shared->attach(
         // 'Zend\Mvc\Controller\AbstractController',
            'Zend\Stdlib\DispatchableInterface',
            MvcEvent::EVENT_DISPATCH,
            array( $this, 'onDispatch' ),
            100
        );
    }