Ensures that there is a root Graph attached to the kernel.
Used privately by the kernel.

@param ?Foundation\AbstractActor The founder object or null (to set
it up with default values or retrieve from the database)

@return void
198547
protected function seedRoot(? Foundation\AbstractActor $founder = null): void
   {  
       $graph_id = $this->database()->get("configs:graph_id");

       if(isset($graph_id)) {
         $this->logger()->info(
           "Existing network with id: %s", 
           $graph_id
         );
         $this["graph"] = $this->share(function($c) use($graph_id) {
            return $c["gs"]->node($graph_id);
          });
           $this["founder"] = $this->share(function($c) { 
           $founder = $c["graph"]->getFounder();
           return $founder;
         });
       }
       else {
          $this->logger()->info("Creating a new graph from scratch");
          if(!is_null($founder)) {
            $founder->persist();
          }
          else {
            throw new Exceptions\FounderMustBeSetException();
          }
          $this["founder"] = $this->share(function($c) use ($founder) {
              return $founder;
          });
          $this["graph"] = $this->share(function($c) {
            $graph_class = $c["config"]->default_objects->graph;
            $graph = new $graph_class($c, $c["founder"], $c["space"], $c["founder"]);
            $c["logger"]->info("Changing founder context as graph");
            $c["founder"]->changeContext($graph);
            //$c["founder"]->hydrate($c, $c["graph"]); // // to make sure that is set up, since the services are now available.
            return $graph;
          });
         $this->database()->set("configs:graph_id", $this->graph()->id());
         $this->logger()->info(
           "New graph with id: %s and founder: %s", $this->graph()->id(), $this->founder()->id()
         );
       }

       $this->logger()->info("Root seed complete. Time to integrate space & graph");
       $this["gs"]->warmUpCache();

       try {
        //  $this["space"]->add($this["graph"]);
          
       }
       catch(NodeAlreadyMemberException $e) {
          // do nothing
       }

       
   }
445532
public function placementAction()
    {
        /** @var \Networking\InitCmsBundle\Entity\MenuItem $rootNode */
        $rootNode = $this->admin->getObject($this->get('session')->get('root_menu_id'));

        if (!$rootNode) {
            throw new NotFoundHttpException();
        }

        if ($rootNode->getChildren()->count() > 1) {
            return $this->listAction(null, null, 'placement', $this->get('session')->get('root_menu_id'));
        } else {
            return false;
        }
    }
659863
public function enterLegacyRootDir()
    {
        $this->previousRunningDir = getcwd();
        if ($this->logger) {
            $this->logger->debug("Legacy kernel: Leaving '$this->previousRunningDir' for '$this->legacyRootDir'");
        }
        chdir($this->legacyRootDir);
    }
705874
private NodeBuilder ensureParent()
    {
        if (parent == null)
        {
            parent = new NodeBuilder();
            parent.child = this;
        }
        if (parent.upperBound == null)
            parent.reset(EMPTY_BRANCH, upperBound, updateFunction, comparator);
        return parent;
    }
1080259
protected function setupRootNode()
    {
        $builder = new TreeBuilder();
        $this->rootNode = $builder->root($this->getBundleName());

        return $this;
    }
213428
public function init() {
        try {
            require_once (REAL_PATH . '\\vendor\\joalcapa\\fundamentary\\src\\Magics.php');
            require(__DIR__.'/Middlewares/Middleware.php');
            KernelDB::getKernel();

            $kernelHttp = $this->kernels[Dir::kernelHttp()];

            $request = $kernelHttp::request();
            if($request->isRootUrl())
                killer('1');

            $data = Auth::initAuth($request);
            $data ? $this->kernels[Dir::kernelHttp()]->makeResponse('200', $data) : $this->apiRest();

            if(!$this->kernels[Dir::kernelHttp()]->response())
                $this->kernels[Dir::kernelHttp()]->makeResponse('404');

        } catch(KillerException $exception) {
            $this->kernels[Dir::kernelException()]->handlerException($exception, $this);
        } catch(AuthExpiredException $exception) {
            $this->kernels[Dir::kernelException()]->handlerException($exception, $this);
        }
    }
144468
private function chdirToSugarDir()
    {
        if (!$this->getApplication()->isInstalled()) {
            throw new SugarException('Unable to find an installed instance of SugarCRM in :' . $this->getPath(), 1);
        }
        $this->lastCwd = realpath(getcwd());
        chdir($this->getPath());
    }
155466
protected function initializeAction()
    {
        parent::initializeAction();
        $this->solrConnectionManager = GeneralUtility::makeInstance(ConnectionManager::class);
        $this->apacheSolrDocumentRepository = GeneralUtility::makeInstance(Repository::class);

    }
685666
private void initPermissionsForPrincipal(JsonEntityBean principal) {
        permissions.add(
                principal.getTypeAndIdHash()
                        + "_"
                        + PortletAdministrationHelper.PortletPermissionsOnForm.BROWSE
                                .getActivity());
        permissions.add(
                principal.getTypeAndIdHash()
                        + "_"
                        + PortletAdministrationHelper.PortletPermissionsOnForm.SUBSCRIBE
                                .getActivity());
    }
439327
public void setRootComponent(Component component) throws IllegalRootComponentException {
        if (component != null && component.getParent() != null) {
            throw new IllegalRootComponentException("A component with parent cannot be set as a graph's root component. Make sure the component doesn't parent.");
        }
        this.rootComponent = component;
    }
781041
protected function initRootUser()
    {
        $this->stdout("\t6) Init root user \n", Console::FG_YELLOW);
        $root = User::findByUsername('root');
        $aManager = \Yii::$app->authManager;
        if ($root && $aManager->getRole(CmsManager::ROLE_ROOT)) {
            if (!$aManager->getAssignment(CmsManager::ROLE_ROOT, $root->primaryKey)) {
                $aManager->assign($aManager->getRole(CmsManager::ROLE_ROOT), $root->primaryKey);
            }
        }
        return $this;
    }
1186304
private function cliHandler()
    {
        // Instantiate CLI Router Service
        $this->services->load(Kernel\Cli\Router::class);

        if (profiler() !== false) {
            profiler()->watch('Parse Router Request');
        }
        router()->parseRequest();

        if ($commander = router()->getCommander()) {
            if ($commander instanceof Kernel\Cli\Router\DataStructures\Commander) {
                // Autoload Language
                language()->loadFile($commander->getParameter());
                language()->loadFile($commander->getRequestMethod());
                language()->loadFile($commander->getParameter() . '/' . $commander->getRequestMethod());

                $modules = $this->modules->getArrayCopy();

                // Run Module Autoloader
                foreach ($modules as $module) {
                    if (in_array($module->getType(), ['KERNEL', 'FRAMEWORK'])) {
                        continue;
                    }
                    $module->loadModel();
                }

                // Autoload Model
                $modelClassName = str_replace('Commanders', 'Models', $commander->getName());

                if (class_exists($modelClassName)) {
                    $this->models->load($modelClassName, 'commander');
                }

                // Initialize Controller
                if (profiler() !== false) {
                    profiler()->watch('Calling Hooks Service: Pre Commander');
                }
                hooks()->callEvent(Framework\Services\Hooks::PRE_COMMANDER);

                if (profiler() !== false) {
                    profiler()->watch('Instantiating Requested Commander: ' . $commander->getClass());
                }
                $requestCommander = $commander->getInstance();

                if (profiler() !== false) {
                    profiler()->watch('Calling Hooks Service: Post Commander');
                }
                hooks()->callEvent(Framework\Services\Hooks::POST_COMMANDER);

                if (profiler() !== false) {
                    profiler()->watch('Execute Requested Commander: ' . $commander->getClass());
                }
                $requestCommander->execute();

                exit(EXIT_SUCCESS);
            }
        }
    }
1322117
@Override public void onCreate() {
    super.onCreate();
    MainModule mainModule = new MainModule(this);
    objectGraph = ObjectGraph.create(mainModule);
    objectGraph.inject(this);
    objectGraph.injectStatics();
  }
548511
private function ensureInitialized()
    {
        if (null !== $this->initialData) {
            $this->buildProcessors();
            $this->buildGroups();
            $this->initialData = null;
        }
    }
910847
protected function initializeControllerContext()
    {

        $request = new ActionRequest(Request::createFromEnvironment());
        $request->setDispatched(true);
        if (isset($this->flowHttpSettings['baseUri'])) {
            $request->getHttpRequest()->setBaseUri(new Uri($this->flowHttpSettings['baseUri']));
        }

        $response = new Response();

        $uriBuilder = new UriBuilder();
        $uriBuilder->setRequest($request);

        $arguments = new Arguments(array());

        $this->controllerContext = new ControllerContext($request, $response, $arguments, $uriBuilder);
    }
901531
public function postLaunchAction()
    {
        $reflected = new \ReflectionClass($this->_controllerInstance);
        if ($reflected->hasMethod('postLaunchAction')) {
            call_user_func(array(
                $this->_controllerInstance,
                'postLaunchAction'
            ), null);
        }
    }
571682
private function startup()
    {
        $this->registerSigHandlers();
        $this->pruneDeadWorkers();
        Event::trigger('beforeFirstFork', $this);
        $this->registerWorker();
    }