Injects Serializer service.

@DI\InjectParams({
"om"      = @DI\Inject("claroline.persistence.object_manager"),
"rootDir" = @DI\Inject("%kernel.root_dir%")
})

@param ObjectManager $om
@param string        $rootDir
965834
public function setObjectManager(ObjectManager $om, $rootDir)
    {
        $this->om = $om;
        $this->rootDir = $rootDir.'/..';
        $this->baseUri = 'https://github.com/claroline/Distribution/tree/master';
    }
409494
public function setRootDirectory($rootDir)
    {
        if ($this->started) {
            throw new LogicException('Puli is already started');
        }

        Assert::nullOrDirectory($rootDir);

        $this->rootDir = $rootDir ? Path::canonicalize($rootDir) : null;
    }
1365002
protected function loadMappingInformation(array $objectManager, ContainerBuilder $container)
    {
        if ($objectManager['auto_mapping']) {
            // automatically register bundle mappings
            foreach (array_keys($container->getParameter('kernel.bundles')) as $bundle) {
                if (!isset($objectManager['mappings'][$bundle])) {
                    $objectManager['mappings'][$bundle] = [
                        'mapping' => true,
                        'is_bundle' => true,
                    ];
                }
            }
        }

        foreach ($objectManager['mappings'] as $mappingName => $mappingConfig) {
            if (null !== $mappingConfig && false === $mappingConfig['mapping']) {
                continue;
            }

            $mappingConfig = array_replace([
                'dir' => false,
                'type' => false,
                'prefix' => false,
            ], (array) $mappingConfig);

            $mappingConfig['dir'] = $container->getParameterBag()->resolveValue($mappingConfig['dir']);
            // a bundle configuration is detected by realizing that the specified dir is not absolute and existing
            if (!isset($mappingConfig['is_bundle'])) {
                $mappingConfig['is_bundle'] = !is_dir($mappingConfig['dir']);
            }

            if ($mappingConfig['is_bundle']) {
                $bundle = null;
                foreach ($container->getParameter('kernel.bundles') as $name => $class) {
                    if ($mappingName === $name) {
                        $bundle = new \ReflectionClass($class);

                        break;
                    }
                }

                if (null === $bundle) {
                    throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled.', $mappingName));
                }

                $mappingConfig = $this->getMappingDriverBundleConfigDefaults($mappingConfig, $bundle, $container);
                if (!$mappingConfig) {
                    continue;
                }
            }

            $this->assertValidMappingConfiguration($mappingConfig, $objectManager['name']);
            $this->setMappingDriverConfig($mappingConfig, $mappingName);
            $this->setMappingDriverAlias($mappingConfig, $mappingName);
        }
    }
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);
    }
822139
protected function createDir($rootDir, $env)
    {
        $cacheDir = $rootDir.sprintf('../var/cache/%s/php_fast_cache', $env);
        if (!file_exists($cacheDir) || !is_writable($cacheDir)) {
            if (!file_exists($cacheDir)) {
                @mkdir($cacheDir, 0777);
            }
            if (!is_writable($cacheDir)) {
                @chmod($cacheDir, 0777);
            }
            if (!file_exists($cacheDir) || !is_writable($cacheDir)) {
                throw new \Exception('Sorry, Please create '.$cacheDir.'/ and SET Mode 0777 or any Writable Permission!', 100);
            }
        }

        return $cacheDir;
    }
524572
public static function objectsManager($instance = null)
    {
        if (!$instance) {
            $className = get_called_class();
            $instance = new $className();
        }

        if (class_exists($managerClass = self::getManagerClass())) {
            return new $managerClass($instance, $instance->getConnection());
        }

        return new TreeManager($instance, $instance->getConnection());
    }
887878
private function createModelManagerService($adminName, Definition $ormModelManager, Definition $proxyRepository)
    {
        $serviceName = sprintf('sonata.%s.model_manager', $adminName);
        $service = new Definition($serviceName);
        $service->setClass('Marmelab\SonataElasticaBundle\Model\ElasticaModelManager');
        $service->setArguments(array(
            $ormModelManager,
            $proxyRepository
        ));

        return $service;
    }
1315556
protected function setRootDir(/*# string */ $rootDir)
    {
        // validate root directory
        if (!is_string($rootDir) || !is_dir($rootDir) || !is_readable($rootDir))
        {
            throw new InvalidArgumentException(
                Message::get(Message::CONFIG_DIR_INVALID, $rootDir),
                Message::CONFIG_DIR_INVALID
            );
        }
        $this->root_dir = rtrim($rootDir, '/\\');

        return $this;
    }
1240289
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $appServiceLocator = $serviceLocator;
        if ($appServiceLocator instanceof AbstractPluginManager) {
            $appServiceLocator->getServiceLocator();
        }

        /** @var ObjectManagerAutoDetectorInterface $objectManagerAutoDetector */
        $objectManagerAutoDetector = $appServiceLocator->get(ObjectManagerAutoDetectorInterface::class);

        /** @var ModuleOptionsPluginManagerInterface $moduleOptionsManager */
        $moduleOptionsManager = $appServiceLocator->get(ModuleOptionsPluginManagerInterface::class);
        /** @var ModuleOptionsInterface $moduleOptions */
        $moduleOptions = $moduleOptionsManager->get(ModuleOptionsInterface::class);

        /** @var DoctrineOrmModuleConfigInterface $doctrineOrmModuleConfig */
        $doctrineOrmModuleConfig = $appServiceLocator->get(DoctrineOrmModuleConfigInterface::class);

        return new OrmEntityLocator($objectManagerAutoDetector, $moduleOptions, $doctrineOrmModuleConfig);
    }
836399
public function load(ObjectManager $manager)
    {
        $password = substr(rtrim(strtr(base64_encode(random_bytes(32)), '+/', '-_'), '='), 0, 8);

        $user1 = $this->createUser(
            $manager,
            'admin',
            $password,
            'admin@domain.com',
            $this->container->getParameter('kunstmaan_admin.default_admin_locale'),
            array('ROLE_SUPER_ADMIN'),
            array($manager->merge($this->getReference(GroupFixtures::REFERENCE_SUPERADMINS_GROUP))),
            true,
            false
        );
        $manager->flush();

        $output = new ConsoleOutput();
        $output->writeln(array(
            "<comment>  > User 'admin' created with password '$password'</comment>",
        ));

        if (Kernel::VERSION_ID < 40000) {
            $file = $this->container->get('kernel')->getProjectDir() . '/app/config/config.yml';
            $contents = file_get_contents($file);
            $contents = str_replace('-adminpwd-', $password, $contents);
            file_put_contents($file, $contents);
        }

        $this->setReference(self::REFERENCE_ADMIN_USER, $user1);
    }
812710
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var DoctrineObjectManagerInterface $doctrineObjectManager */
        $doctrineObjectManager = $serviceLocator->get(DoctrineObjectManagerInterface::class);

        /** @var ModuleOptionsPluginManagerInterface $moduleOptionsPluginManager */
        $moduleOptionsPluginManager = $serviceLocator->get(ModuleOptionsPluginManagerInterface::class);

        /** @var EntityManagerInterface $entityManager */
        $entityManager = $serviceLocator->get(EntityManagerInterface::class);

        return new EntityMapBuilder($doctrineObjectManager, $moduleOptionsPluginManager, $entityManager);
    }
47663
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var ModuleOptionsPluginManagerInterface $moduleOptionsPluginManager */
        $moduleOptionsPluginManager = $serviceLocator->get(ModuleOptionsPluginManagerInterface::class);
        /** @var ModuleOptionsInterface $moduleOptions */
        $moduleOptions = $moduleOptionsPluginManager->get(ModuleOptionsInterface::class);

        $managerRegistryOptions = $moduleOptions->getManagerRegistry();


        $buildListConnectionsResult = $this->getEventManager()->trigger(static::EVENT_BUILD_LIST_CONNECTIONS, $this);
        $listConnectionsResult = [];
        foreach ($buildListConnectionsResult as $item) {
            if (is_array($item)) {
                $listConnectionsResult = ArrayUtils::merge($listConnectionsResult, $item);
            }
        }
        $listConnectionsResult = ArrayUtils::merge($listConnectionsResult, $managerRegistryOptions->getConnections());


        $buildListObjectManagersResult = $this->getEventManager()->trigger(static::EVENT_BUILD_LIST_OBJECT_MANAGERS, $this);
        $listObjectManagersResult = [];
        foreach ($buildListObjectManagersResult as $item) {
            if (is_array($item)) {
                $listObjectManagersResult = ArrayUtils::merge($listObjectManagersResult, $item);
            }
        }
        $listObjectManagersResult = ArrayUtils::merge($listObjectManagersResult, $managerRegistryOptions->getObjectManagers());

        return new ManagerRegistry(
            ManagerRegistry::NAME,
            $listConnectionsResult,
            $listObjectManagersResult,
            $managerRegistryOptions->getDefaultConnection(),
            $managerRegistryOptions->getDefaultManager(),
            $managerRegistryOptions->getProxyInterfaceName()
        );
    }
697189
protected function createRepository(DocumentManager $documentManager, string $documentName) : ObjectRepository
    {
        $metadata = $documentManager->getClassMetadata($documentName);

        if ($metadata->customRepositoryClassName) {
            $repositoryClassName = $metadata->customRepositoryClassName;
        } elseif ($metadata->isFile) {
            $repositoryClassName = $documentManager->getConfiguration()->getDefaultGridFSRepositoryClassName();
        } else {
            $repositoryClassName = $documentManager->getConfiguration()->getDefaultDocumentRepositoryClassName();
        }

        return $this->instantiateRepository($repositoryClassName, $documentManager, $metadata);
    }
815517
public function load(ObjectManager $manager)
    {
        /**
         * @var ObjectDirector $menuNodeDirector
         */
        $menuNodeDirector = $this->getDirector('menu_node');

        $menuNodeHim = $menuNodeDirector
            ->create()
            ->setName('him')
            ->setCode('him')
            ->setUrl('elcodi.dev/him')
            ->setActiveUrls([])
            ->setEnabled(true);

        $menuNodeHer = $menuNodeDirector
            ->create()
            ->setName('her')
            ->setCode('her')
            ->setUrl('elcodi.dev/her')
            ->setActiveUrls(
                [
                    'her_products_list_route',
                    'her_offers_list_route',
                ]
            )
            ->setEnabled(true);

        $menuNodeVogue = $menuNodeDirector
            ->create()
            ->setName('vogue')
            ->setCode('vogue')
            ->setEnabled(true)
            ->setActiveUrls([])
            ->addSubnode($menuNodeHim)
            ->addSubnode($menuNodeHer);

        $menuNodeDirector->save($menuNodeVogue);
        $this->addReference('menu-node-him', $menuNodeHim);
        $this->addReference('menu-node-her', $menuNodeHer);
        $this->addReference('menu-node-vogue', $menuNodeVogue);
    }
1283045
public static function objectSerialize($targetObject, $rootName)
    {
        Validate::notNull($targetObject, 'targetObject');
        Validate::isString($rootName, 'rootName');

        $container = new \stdClass();

        $container->$rootName = $targetObject;

        return json_encode($container);
    }
73312
protected function expandAppDirs(ConfigInterface $config, $rootDir) {
        if (!is_string($rootDir))                          throw new IllegalTypeException('Illegal type of config option "app.dir.root": '.gettype($rootDir));
        if (!strlen($rootDir) || isRelativePath($rootDir)) throw new InvalidArgumentException('Invalid config option "app.dir.root": "'.$rootDir.'" (not an absolute path)');

        $rootDir = rtrim(str_replace('\\', '/', $rootDir), '/');
        $dirs = $config->get('app.dir', []);
        $this->expandDirsRecursive($dirs, $rootDir);

        $config->set('app.dir', $dirs);                     // store everything back
    }
164659
public function createService(ServiceLocatorInterface $serviceManager)
    {
        /** @var \Doctrine\ORM\EntityManager $objectManager */
        $objectManager = $serviceManager->get('Doctrine\ORM\EntityManager');

        /** @var \Eye4web\Zf2Board\Options\ModuleOptionsInterface $options */
        $options = $serviceManager->get('Eye4web\Zf2Board\Options\ModuleOptions');

        $mapper = new PostMapper($objectManager, $options);

        return $mapper;
    }