Loads one meta type (document) and four resource types handled by the platform core :
- File
- Directory
- Link
- Text
All these resource types have the 'document' meta type.

@param ObjectManager $manager
438081
public function load(ObjectManager $manager)
    {
        // resource type attributes : name, listable, navigable, class
        $resourceTypes = array(
            array('file', true),
            array('directory', true),
            array('text', true),
            array('resource_shortcut', false),
            array('activity', true)
        );

        $types[] = array();

        foreach ($resourceTypes as $attributes) {
            $type = new ResourceType();
            $type->setName($attributes[0]);
            $type->setExportable($attributes[1]);
            $manager->persist($type);
            $this->container->get('claroline.manager.mask_manager')->addDefaultPerms($type);
            $types[$attributes[0]] = $type;
        }

        //add special actions.
        $composeDecoder = new MaskDecoder();
        $composeDecoder->setValue(pow(2, 10));
        $composeDecoder->setName('compose');
        $composeDecoder->setResourceType($types['activity']);
        $manager->persist($composeDecoder);

        $activityMenu = new MenuAction();
        $activityMenu->setName('compose');
        $activityMenu->setAsync(false);
        $activityMenu->setIsCustom(true);
        $activityMenu->setValue(pow(2, 10));
        $activityMenu->setResourceType($types['activity']);
        $activityMenu->setIsForm(false);
        $manager->persist($activityMenu);

        $updateFile = new MenuAction();
        $updateFile->setName('update_file');
        $updateFile->setAsync(true);
        $updateFile->setIsCustom(true);
        $updateFile->setIsForm(false);
        $updateFile->setResourceType($types['file']);
        //16 is default for edit
        $updateFile->setValue(16);
        $manager->persist($updateFile);

        $fileAction = new ActivityRuleAction();
        $fileAction->setAction('resource-read');
        $fileAction->setResourceType($types['file']);
        $manager->persist($fileAction);

        $textAction = new ActivityRuleAction();
        $textAction->setAction('resource-read');
        $textAction->setResourceType($types['text']);
        $manager->persist($textAction);

        $badgeAwardAction = new ActivityRuleAction();
        $badgeAwardAction->setAction('badge-awarding');
        $manager->persist($badgeAwardAction);
    }
43314
public function load(ObjectManager $manager)
    {
        if ($this->container->getParameter('kunstmaan_admin.multi_language')) {
            $languages = explode('|', $this->container->getParameter('kunstmaan_admin.required_locales'));
        }
        if (!is_array($languages) || count($languages) < 1) {
            $languages = array('en');
        }

        $em = $this->container->get('doctrine.orm.entity_manager');

        $pageCreator = $this->container->get('kunstmaan_node.page_creator_service');

        // Create article overview page
        $nodeRepo = $em->getRepository('KunstmaanNodeBundle:Node');
        $homePage = $nodeRepo->findOneBy(array('internalName' => 'homepage'));

        $searchPage = new SearchPage();
        $searchPage->setTitle('Search');

        $translations = array();
        foreach ($languages as $lang) {
            if ($lang == 'nl') {
                $title = 'Zoeken';
            } else {
                $title = 'Search';
            }

            $translations[] = array('language' => $lang, 'callback' => function($page, $translation, $seo) use($title) {
                $translation->setTitle($title);
                $translation->setWeight(50);
                $slugifier = $this->container->get('kunstmaan_utilities.slugifier');
                $translation->setSlug($slugifier->slugify($title));
            });
        }

        $options = array(
            'parent' => $homePage,
            'page_internal_name' => 'search',
            'set_online' => true,
            'hidden_from_nav' => true,
            'creator' => 'Admin'
        );

        $pageCreator->createPage($searchPage, $translations, $options);
    }
1221668
public function load(ObjectManager $manager)
    {
        $testClient = new ApiClient();
        $testClient->setName('Test client');
        $testClient->setKey('test_key');
        $testClient->setSecret('test_secret');
        $testClient->setTrusted(true);

        $manager->persist($testClient);
        $manager->flush();
    }
776452
public function loadEntityMap($objectManagerName)
    {
        $key = $this->getCacheKeyForObjectManagerName($objectManagerName);

        $cache = $this->getCache();

        if (false === $cache->contains($key)) {
            return false;
        }

        return $cache->fetch($key);
    }
424699
public function collection(
        ResourceManager $resourceManager,
        ApiRequest $request,
        int $version,
        string $resource
    )
    {
        $resourceManager->version($version);

        /** @var HandlesCollectionRequest $handler */
        $handler = $this->initializeHandler($resourceManager, $resource, $request, HandlesCollectionRequest::class);

        $parameters = $request->asParameters();

        $repository = $this->initializeRepository($resourceManager, $resource, $parameters);

        $result = $handler->index($repository, $parameters);

        $document = $this->makeDocumentFromCollection($resourceManager, $resource, $result, $parameters, $handler);

        return $this->respond($document);
    }
222210
public function load(ObjectManager $manager)
    {
        $windowMaker = new HubWindowMaker();
        $windowMaker->setHub($this->getReference('sam-hub'));
        $windowMaker->setDeliveryType(HubWindow::DELIVERY_TYPE_PICKUP);
        $windowMaker->setDayOfWeekNumber(6);
        $windowMaker->setStartTime('09:00');
        $windowMaker->setEndTime('11:00');

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

        $windowMaker = new HubWindowMaker();
        $windowMaker->setHub($this->getReference('sam-hub'));
        $windowMaker->setDeliveryType(HubWindow::DELIVERY_TYPE_PICKUP);
        $windowMaker->setDayOfWeekNumber(6);
        $windowMaker->setStartTime('11:00');
        $windowMaker->setEndTime('13:00');

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


        $windowMaker = new HubWindowMaker();
        $windowMaker->setHub($this->getReference('nick-hub'));
        $windowMaker->setDeliveryType(HubWindow::DELIVERY_TYPE_PICKUP);
        $windowMaker->setDayOfWeekNumber(6);
        $windowMaker->setStartTime('09:00');
        $windowMaker->setEndTime('11:00');

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

        $windowMaker = new HubWindowMaker();
        $windowMaker->setHub($this->getReference('nick-hub'));
        $windowMaker->setDeliveryType(HubWindow::DELIVERY_TYPE_PICKUP);
        $windowMaker->setDayOfWeekNumber(6);
        $windowMaker->setStartTime('11:00');
        $windowMaker->setEndTime('13:00');

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


        $windowMaker = new HubWindowMaker();
        $windowMaker->setHub($this->getReference('ramon-hub'));
        $windowMaker->setDeliveryType(HubWindow::DELIVERY_TYPE_PICKUP);
        $windowMaker->setDayOfWeekNumber(6);
        $windowMaker->setStartTime('09:00');
        $windowMaker->setEndTime('11:00');

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

        $windowMaker = new HubWindowMaker();
        $windowMaker->setHub($this->getReference('ramon-hub'));
        $windowMaker->setDeliveryType(HubWindow::DELIVERY_TYPE_PICKUP);
        $windowMaker->setDayOfWeekNumber(6);
        $windowMaker->setStartTime('11:00');
        $windowMaker->setEndTime('13:00');

        $manager->persist($windowMaker);
        $manager->flush();
    }
464134
public function load(ObjectManager $manager)
    {
        for($i=1; $i <= 4; $i++)
        {

            $post = new Post();
            $post->setName('title'.$i);
            $post->setSlug('title-'.$i);
            $post->setContent('content '.$i);
            $post->setCreatedAt(new \DateTime());

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

        }
    }
776833
public function load(ObjectManager $manager)
    {
        /**
         * Carts.
         *
         * @var CartInterface     $emptyCart
         * @var CartInterface     $fullCart
         * @var CustomerInterface $customer1
         * @var CustomerInterface $customer2
         * @var ProductInterface  $product
         * @var ProductInterface  $productReduced
         * @var CartLineInterface $cartLine1
         * @var CartLineInterface $cartLine2
         * @var ObjectDirector    $cartDirector
         * @var ObjectDirector    $cartLineDirector
         * @var AddressInterface  $address1
         * @var AddressInterface  $address2
         */
        $cartDirector = $this->getDirector('cart');
        $cartLineDirector = $this->getDirector('cart_line');

        $customer1 = $this->getReference('customer-1');
        $customer2 = $this->getReference('customer-2');
        $product = $this->getReference('product');
        $productReduced = $this->getReference('product-reduced');

        $address1 = $this->getReference('address-sant-celoni');
        $address2 = $this->getReference('address-viladecavalls');

        /**
         * Empty cart.
         */
        $emptyCart = $cartDirector
            ->create()
            ->setCustomer($customer1);

        $cartDirector->save($emptyCart);
        $this->addReference('empty-cart', $emptyCart);

        /**
         * Full cart.
         */
        $fullCart = $cartDirector
            ->create()
            ->setCustomer($customer2);

        $cartLine1 = $cartLineDirector
            ->create()
            ->setPurchasable($product)
            ->setPurchasableAmount($product->getPrice())
            ->setAmount($product->getPrice())
            ->setQuantity(2)
            ->setCart($fullCart);

        $cartLine2 = $cartLineDirector
            ->create()
            ->setPurchasable($productReduced)
            ->setPurchasableAmount($productReduced->getPrice())
            ->setAmount($productReduced->getPrice())
            ->setQuantity(2)
            ->setCart($fullCart);

        $fullCart
            ->addCartLine($cartLine1)
            ->addCartLine($cartLine2);

        $fullCart->setBillingAddress($address1);
        $fullCart->setDeliveryAddress($address2);

        $cartDirector->save($fullCart);
        $this->addReference('full-cart', $fullCart);
    }
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();
    }
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);
    }
721499
public function load(ObjectManager $manager)
    {
        /**
         * @var ObjectDirector    $currencyExchangeRateDirector
         * @var CurrencyInterface $currencyEuro
         * @var CurrencyInterface $currencyDollar
         * @var CurrencyInterface $currencyPound
         * @var CurrencyInterface $currencyIen
         */
        $currencyExchangeRateDirector = $this->getDirector('currency_exchange_rate');
        $currencyEuro = $this->getReference('currency-euro');
        $currencyDollar = $this->getReference('currency-dollar');
        $currencyPound = $this->getReference('currency-pound');
        $currencyIen = $this->getReference('currency-ien');

        /**
         * Dollar to Euro.
         */
        $dollarToEuroRate = $currencyExchangeRateDirector
            ->create()
            ->setSourceCurrency($currencyDollar)
            ->setTargetCurrency($currencyEuro)
            ->setExchangeRate(0.736596);

        $currencyExchangeRateDirector->save($dollarToEuroRate);

        /**
         * Dollar to Pound.
         */
        $dollarToPoundRate = $currencyExchangeRateDirector
            ->create()
            ->setSourceCurrency($currencyDollar)
            ->setTargetCurrency($currencyPound)
            ->setExchangeRate(0.588765);

        $currencyExchangeRateDirector->save($dollarToPoundRate);

        /**
         * Dollar to Yen.
         */
        $dollarToIenRate = $currencyExchangeRateDirector
            ->create()
            ->setSourceCurrency($currencyDollar)
            ->setTargetCurrency($currencyIen)
            ->setExchangeRate(101.822625);

        $currencyExchangeRateDirector->save($dollarToIenRate);
    }
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);
    }
1062889
public function load(ObjectManager $manager)
    {
        /**
         * @var ObjectDirector $storeDirector
         */
        $storeDirector = $this->getDirector('store');
        $address = $this->getReference('address-sant-celoni');
        $language = $this->getReference('language-es');
        $currency = $this->getReference('currency-euro');

        $store = $storeDirector
            ->create()
            ->setName('Store')
            ->setLeitmotiv('Uh yes, I don\'t know what... this is a store...')
            ->setEmail('email@email.com')
            ->setTracker('123456')
            ->setTemplate('fhsjkhfjklsa')
            ->setUseStock(true)
            ->setAddress($address)
            ->setDefaultLanguage($language)
            ->setDefaultCurrency($currency);

        $storeDirector->save($store);
        $this->setReference('store', $store);
    }
446652
public function load(ObjectManager $manager)
    {
        $enTag = new Language;
        $enTag->setId('en');
        $enTag->setName(Translatable::createFromOriginalString('English'));

        $manager->persist($enTag);
        $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);
    }
1334401
private static function isValidManager(ObjectManager $manager, $class)
    {
        $meta = $manager->getClassMetadata($class);

        return !$meta instanceof OrmClassMetadata || !$meta->isMappedSuperclass;
    }
600609
public function load(ObjectManager $manager)
    {
        $userRole = new Role();
        $userRole->setRoleId('user');

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

        $adminRole = new Role();
        $adminRole->setRoleId('admin');
        $adminRole->setParent($userRole);

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

        $supervisorRole = new Role();
        $supervisorRole->setRoleId('supervisor');
        $supervisorRole->setParent($userRole);

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

        $gameManagerRole = new Role();
        $gameManagerRole->setRoleId('game-manager');
        $gameManagerRole->setParent($supervisorRole);

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

        // store reference to admin role for User relation to Role
        $this->addReference('admin-role', $adminRole);
        $this->addReference('supervisor-role', $supervisorRole);
        $this->addReference('game-role', $gameManagerRole);
    }