Loads the core widgets.

@param ObjectManager $manager
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);
        }
    }
282637
public function load(ObjectManager $manager)
    {
        /**
         * @var ObjectDirector $menuDirector
         */
        $menuDirector = $this->getDirector('menu');

        /**
         * Admin menu.
         */
        $menuAdmin = $menuDirector
            ->create()
            ->setCode('menu-admin')
            ->setEnabled(true)
            ->addSubnode($this->getReference('menu-node-vogue'));

        $menuDirector->save($menuAdmin);
        $this->addReference('menu-admin', $menuAdmin);

        /**
         * Front menu.
         */
        $menuFront = $menuDirector
            ->create()
            ->setCode('menu-front')
            ->setEnabled(true)
            ->addSubnode($this->getReference('menu-node-him'))
            ->addSubnode($this->getReference('menu-node-her'));

        $menuDirector->save($menuFront);
        $this->addReference('menu-front', $menuFront);
    }
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);
    }
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);
    }
402797
public function boot(DoctrineManager $manager)
    {
        $manager->extendAll(function (Configuration $configuration) {
            $configuration->setCustomDatetimeFunctions($this->datetime);
            $configuration->setCustomNumericFunctions($this->numeric);
            $configuration->setCustomStringFunctions($this->string);
        });
    }
256474
public function manager(RendererManager $manager, Container $container)
    {
        $this->rendererManager = $manager;

        // Prepare Globals
        $this->prepareGlobals($container, $manager);

        return $manager;
    }
808476
protected function addListenersFromArray(SharedEventManagerInterface $manager, $id, $name)
    {
        if (!isset($this->data[$id][$name]) || (!is_array($this->data[$id][$name])
          && !($this->data[$id][$name] instanceof \Traversable))) {
            return $this;
        }

        $objectManager = $this->getObjectManager();

        foreach ($this->data[$id][$name] as $listener) {
            if (!$listener) {
                continue;
            }

            $priority = 1;

            if (is_array($listener) && isset($listener['listener'])) {
                $priority = (isset($listener['priority']))? (int)$listener['priority'] : 1;
                $listener = $listener['listener'];
            }

            if (is_string($listener)) {
                $listener = $objectManager->get($listener);
            }

            $manager->attach($id, $name, $listener, $priority);
        }

        return $this;
    }
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();

        }
    }
862511
function (manager) {
  this.config = {};
  this.manager = manager;
  this.debug = manager.debug;
  this.binder = new ProxyBinder(this.manager);
  this.api = this.manager.api;
  this.manifests = {};
  this.providers = {};

  this.id = 'ModuleInternal';
  this.pendingPorts = 0;
  this.requests = {};
  this.unboundPorts = {};

  util.handleEvents(this);
}
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);
    }
496950
public function load(ObjectManager $manager)
    {
        $this->manager = $manager;
        $options = $this->getOptions();

        $parser = new Parser();

        $data = [];
        foreach ($this->getFixtures() as $fixture) {
            $data[] = $parser->parse(file_get_contents($fixture));
        }

        $fixtures = $this->initFixtures($data);
        $builder = $this->container->get('kunstmaan_fixtures.builder.builder');
        $locale = isset($options['locale']) ? $options['locale'] : 'en_US';

        foreach ($this->getProviders() as $provider) {
            $builder->addProvider($provider);
        }

        /*
         * because of faker's magic calls we'll want to add this as last provider
         */
        $builder->addProvider(Factory::create($locale));
        $builder->setFixtures($fixtures);
        $builder->buildFixtures($manager);
    }
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();
    }
1302050
public function load(ObjectManager $manager)
    {
        $geocoder = new \HarvestCloud\GeoBundle\Util\GoogleGeocoder();

        $user = new User();
        $user->setEmail('sam.hub@example.com');
        $user->setFirstname('Sam');
        $user->setLastname('Hub');
        $user->setEnabled(true);

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

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

        $profile = new Profile();
        $profile->setName($user->getFullname());
        $profile->setSystemHubStatus(Profile::STATUS_ENABLED);
        $profile->setHubStatus(Profile::STATUS_ACTIVE);

        $user->addProfile($profile);

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

        $geocoder->geocode($location);

        $profile->addLocation($location);

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

        $this->addReference('sam-hub', $profile);


        $user = new User();
        $user->setEmail('nick.hub@example.com');
        $user->setFirstname('Nick');
        $user->setLastname('Hub');
        $user->setEnabled(true);

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

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

        $profile = new Profile();
        $profile->setName($user->getFullname());
        $profile->setSystemHubStatus(Profile::STATUS_ENABLED);
        $profile->setHubStatus(Profile::STATUS_ACTIVE);

        $user->addProfile($profile);

        $location = new Location();
        $location->setName('Default');
        $location->setAddressLine1('100 Main Street');
        $location->setTown('Stockbridge');
        $location->setStateCode('MA');
        $location->setPostalCode('01262');

        $geocoder->geocode($location);

        $profile->addLocation($location);

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

        $this->addReference('nick-hub', $profile);


        $user = new User();
        $user->setEmail('ramon.hub@example.com');
        $user->setFirstname('Ramon');
        $user->setLastname('Hub');
        $user->setEnabled(true);

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

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

        $profile = new Profile();
        $profile->setName($user->getFullname());
        $profile->setSystemHubStatus(Profile::STATUS_ENABLED);
        $profile->setHubStatus(Profile::STATUS_ACTIVE);

        $user->addProfile($profile);

        $location = new Location();
        $location->setName('Default');
        $location->setAddressLine1('10 East Street');
        $location->setTown('Lenox');
        $location->setStateCode('MA');
        $location->setPostalCode('01240');

        $geocoder->geocode($location);

        $profile->addLocation($location);

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

        $this->addReference('ramon-hub', $profile);
    }
908557
public function onBeforeAddToManager(Manager $manager)
    {
        /* @var DataObjectScaffolder $owner */
        $owner = $this->owner;
        $memberType = StaticSchema::inst()->typeNameForDataObject(Member::class);
        $instance = $owner->getDataObjectInstance();
        $class = $owner->getDataObjectClass();
        if (!$instance->hasExtension(Versioned::class)) {
            return;
        }
        /* @var ObjectType $rawType */
        $rawType = $owner->scaffold($manager);

        $versionName = $this->createVersionedTypeName($class);
        $coreFieldsFn = $rawType->config['fields'];
        // Create the "version" type for this dataobject. Takes the original fields
        // and augments them with the Versioned_Version specific fields
        $versionType = new ObjectType([
            'name' => $versionName,
            'fields' => function () use ($coreFieldsFn, $manager, $memberType) {
                $coreFields = $coreFieldsFn();
                $versionFields = [
                    'Author' => [
                        'type' => $manager->getType($memberType),
                        'resolve' => function ($obj) {
                            return $obj->Author();
                        }
                    ],
                    'Publisher' => [
                        'type' => $manager->getType($memberType),
                        'resolve' => function ($obj) {
                            return $obj->Publisher();
                        }
                    ],
                    'Published' => [
                        'type' => Type::boolean(),
                        'resolve' => function ($obj) {
                            return $obj->WasPublished;
                        }
                    ],
                    'LiveVersion' => [
                        'type' => Type::boolean(),
                        'resolve' => function ($obj) {
                            return $obj->isLiveVersion();
                        }
                    ],
                    'LatestDraftVersion' => [
                        'type' => Type::boolean(),
                        'resolve' => function ($obj) {
                            return $obj->isLatestDraftVersion();
                        }
                    ],
                ];
                // Remove this recursive madness.
                unset($coreFields['Versions']);

                return array_merge($coreFields, $versionFields);
            }
        ]);

        $manager->addType($versionType, $versionName);

        // With the version type in the manager now, add the versioning fields to the dataobject type
        $owner
            ->addFields(['Version'])
            ->nestedQuery('Versions', new ReadVersions($class, $versionName));
    }
851441
public function setConnectionManager(ManagerInterface $manager)
    {
        $this->connectionManager = $manager;
        foreach ($this->servers as $server) {
            $this->connectionManager->addServer($server);
        }
    }
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();
    }
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']);
    }