Creates a new naming context and add's it to the passed manager.

@param \AppserverIo\Psr\Application\ManagerInterface $manager The manager to add the naming context to

@return void
763673
public static function visit(ManagerSettingsAwareInterface $manager)
    {

        // load the path to the web application
        $application = $manager->getApplication();
        $webappPath = $application->getWebappPath();

        // initialize the variable for the properties
        $properties = null;

        // load the configuration base directory
        if ($baseDirectory = $manager->getManagerSettings()->getBaseDirectory()) {
            // look for naming context properties in the manager's base directory
            $propertiesFile = DirectoryKeys::realpath(
                sprintf('%s/%s/%s', $webappPath, $baseDirectory, NamingContextFactory::CONFIGURATION_FILE)
            );

            // load the properties from the configuration file
            if (file_exists($propertiesFile)) {
                $properties = Properties::create()->load($propertiesFile);
            }
        }

        // create the initial context instance
        $initialContext = new InitialContext($properties);
        $initialContext->injectApplication($application);

        // set the initial context in the manager
        $manager->injectInitialContext($initialContext);
    }
324745
public function load(ObjectManager $manager)
    {
        $group1 = $this->createGroup($manager, 'Administrators', array(
            $this->getReference(RoleFixtures::REFERENCE_PERMISSIONMANAGER_ROLE),
            $this->getReference(RoleFixtures::REFERENCE_ADMIN_ROLE),
        ));

        $group2 = $this->createGroup($manager, 'Guests', array(
            $this->getReference(RoleFixtures::REFERENCE_GUEST_ROLE),
        ));

        $group3 = $this->createGroup($manager, 'Super administrators', array(
            $this->getReference(RoleFixtures::REFERENCE_PERMISSIONMANAGER_ROLE),
            $this->getReference(RoleFixtures::REFERENCE_ADMIN_ROLE),
            $this->getReference(RoleFixtures::REFERENCE_SUPERADMIN_ROLE),
        ));

        $manager->flush();

        $this->addReference(self::REFERENCE_ADMINS_GROUP, $group1);
        $this->addReference(self::REFERENCE_GUESTS_GROUP, $group2);
        $this->addReference(self::REFERENCE_SUPERADMINS_GROUP, $group3);
    }
613858
public function attach(EventManagerInterface $events)
    {
        $sharedManager = $events->getSharedManager();
        $sharedManager->attach(ManagerRegistryFactory::class, ManagerRegistryFactory::EVENT_BUILD_LIST_CONNECTIONS, [$this, 'buildListConnectionsHandler']);
        $sharedManager->attach(ManagerRegistryFactory::class, ManagerRegistryFactory::EVENT_BUILD_LIST_OBJECT_MANAGERS, [$this, 'buildListObjectManagersHandler']);
    }
541063
public function fire(PackageManagerInterface $manager)
    {
        $packages = [];

        $i = 0;

        /** @var PackageInterface[] $packagesList */
        $packagesList = $manager->all();

        foreach ($packagesList as $name => $package) {
            /** @var AssetElementInterface[] $files */
            $files = $package->all();

            foreach ($files as $file) {
                if (isset($packages[$name])) {
                    $packages[$i]['id'] = '';
                    $packages[$i]['files'] = $file->getSrc();
                    $packages[$i]['deps'] = $file->getDependency();

                    $i++;
                } else {
                    $packages[$name]['id'] = $name;
                    $packages[$name]['files'] = $file->getSrc();
                    $packages[$name]['deps'] = $file->getDependency();
                }
            }

            $packages[$i] = new TableSeparator();
            $i++;
        }

        foreach ($packages as $i => $data) {
            foreach ($data as $key => $rows) {
                if (is_array($rows)) {
                    $packages[$i][$key] = implode(', ', $rows);
                }
            }
        }

        $this->table($this->headers, $packages);
    }
516542
public function addManager($manager)
    {
        if (is_array($manager)) {
            foreach ($manager as $item) {
                $this->managerList->add($item);
            }

            return $this;
        }

        $this->managerList->add($manager);

        return $this;
    }
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);
    }
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);
    }
659569
private function createManagerDefinition()
    {
        $id = $this->getServiceId('manager');
        if (!$this->container->has($id)) {
            $this->container->setAlias($id, new Alias($this->getManagerServiceId()));
        }
    }
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);
    }
492156
public function load(ObjectManager $manager)
    {
        $loader = new Loader();
        $loader->addFile(__DIR__.'/../../Resources/config/data/Metas.yml');
        $loader->load($manager, null, $this);
    }
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();
    }
357030
public function addBuilder(ManagerBuilder $builder)
    {
        $builderName = (string) $builder->getName();
        if ($builderName === '') {
            throw new \RuntimeException('Only named manager builders allowed');
        }

        if (array_key_exists($builderName, $this->builders)) {
            throw new \RuntimeException(sprintf('"%s" manager builder is already registered', $builderName));
        }

        $this->builders[$builderName] = $builder;
    }
851441
public function setConnectionManager(ManagerInterface $manager)
    {
        $this->connectionManager = $manager;
        foreach ($this->servers as $server) {
            $this->connectionManager->addServer($server);
        }
    }
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();

        }
    }
811868
public function register(ShortcodeInterface $shortcode, ?string $name = null): ManagerInterface
    {
        parent::register($shortcode, $name);
        if ($shortcode instanceof AliasInterface) {
            foreach ($shortcode->getAlias() as $alias) {
                if (!$this->isRegistered($alias)) {
                    parent::register($shortcode, $alias);
                }
            }
        }

        return $this;
    }
550174
public function setManager(Closure $manager)
    {
        if (!is_callable($manager)) {
            throw new Exception('Manager must be callable.');
        }

        $this->manager = $manager;

        return $this;
    }
723698
public function add(BuilderInterface $builder)
    {
        if (method_exists($builder, 'getName')) {
            $name = $builder->getName();
        } else {
            $name = bin2hex(random_bytes(30));
        }

        $this->bag[$name] = $builder;

        return $name;
    }