private function updateSteps()
    {
        $this->log('Initializing resource node of steps...');

        /** @var ObjectManager $om */
        $om = $this->container->get('claroline.persistence.object_manager');
        $steps = $om->getRepository('Innova\PathBundle\Entity\Step')->findAll();

        $om->startFlushSuite();
        $i = 0;

        /** @var Step $step */
        foreach ($steps as $step) {
            /** @var Activity $activity */
            $activity = $step->getActivity();

            if (!empty($activity)) {
                if (!empty($activity->getPrimaryResource())) {
                    $step->setResource($activity->getPrimaryResource());
                }
                $step->setTitle($activity->getResourceNode()->getName());
                $step->setDescription($activity->getDescription());

                $parameters = $activity->getParameters();

                if (!empty($parameters)) {
                    $order = 0;

                    foreach ($parameters->getSecondaryResources() as $resource) {
                        $secondaryResource = new SecondaryResource();
                        $secondaryResource->setResource($resource);
                        $secondaryResource->setOrder($order);
                        $step->addSecondaryResource($secondaryResource);
                        $om->persist($secondaryResource);
                        ++$order;
                    }
                }
                $om->persist($step);
            }
            ++$i;

            if ($i % 250 === 0) {
                $om->forceFlush();
            }
        }

        $om->endFlushSuite();
    }
private function updateSteps()
    {
        $this->log('Initializing resource node of steps...');

        /** @var ObjectManager $om */
        $om = $this->container->get('claroline.persistence.object_manager');
        $steps = $om->getRepository('Innova\PathBundle\Entity\Step')->findAll();

        $om->startFlushSuite();
        $i = 0;

        /** @var Step $step */
        foreach ($steps as $step) {
            /** @var Activity $activity */
            $activity = $step->getActivity();

            if (!empty($activity)) {
                if (!empty($activity->getPrimaryResource())) {
                    $step->setResource($activity->getPrimaryResource());
                }
                $step->setTitle($activity->getResourceNode()->getName());
                $step->setDescription($activity->getDescription());

                $parameters = $activity->getParameters();

                if (!empty($parameters)) {
                    $order = 0;

                    foreach ($parameters->getSecondaryResources() as $resource) {
                        $secondaryResource = new SecondaryResource();
                        $secondaryResource->setResource($resource);
                        $secondaryResource->setOrder($order);
                        $step->addSecondaryResource($secondaryResource);
                        $om->persist($secondaryResource);
                        ++$order;
                    }
                }
                $om->persist($step);
            }
            ++$i;

            if ($i % 250 === 0) {
                $om->forceFlush();
            }
        }

        $om->endFlushSuite();
    }
private function updateSteps ( ) { $ this -> log ( 'Initializing resource node of steps...' ) ; /** @var ObjectManager $om */ $ om = $ this -> container -> get ( 'claroline.persistence.object_manager' ) ; $ steps = $ om -> getRepository ( 'Innova\PathBundle\Entity\Step' ) -> findAll ( ) ; $ om -> startFlushSuite ( ) ; $ i = 0 ; /** @var Step $step */ foreach ( $ steps as $ step ) { /** @var Activity $activity */ $ activity = $ step -> getActivity ( ) ; if ( ! empty ( $ activity ) ) { if ( ! empty ( $ activity -> getPrimaryResource ( ) ) ) { $ step -> setResource ( $ activity -> getPrimaryResource ( ) ) ; } $ step -> setTitle ( $ activity -> getResourceNode ( ) -> getName ( ) ) ; $ step -> setDescription ( $ activity -> getDescription ( ) ) ; $ parameters = $ activity -> getParameters ( ) ; if ( ! empty ( $ parameters ) ) { $ order = 0 ; foreach ( $ parameters -> getSecondaryResources ( ) as $ resource ) { $ secondaryResource = new SecondaryResource ( ) ; $ secondaryResource -> setResource ( $ resource ) ; $ secondaryResource -> setOrder ( $ order ) ; $ step -> addSecondaryResource ( $ secondaryResource ) ; $ om -> persist ( $ secondaryResource ) ; ++ $ order ; } } $ om -> persist ( $ step ) ; } ++ $ i ; if ( $ i % 250 === 0 ) { $ om -> forceFlush ( ) ; } } $ om -> endFlushSuite ( ) ; }
Initializes Steps resource node from activity resource.
Initializes Steps resource node from activity resource .