plugin/competency/Manager/CompetencyManager.php
public function ensureHasScale()
    {
        if (!$this->hasScales()) {
            $defaultScale = new Scale();
            $defaultScale->setName(
                $this->translator->trans('scale.default_name', [], 'competency')
            );
            $defaultLevel = new Level();
            $defaultLevel->setValue(0);
            $defaultLevel->setName(
                $this->translator->trans('scale.default_level_name', [], 'competency')
            );
            $defaultScale->setLevels(new ArrayCollection([$defaultLevel]));
            $this->om->persist($defaultScale);
            $this->om->flush();
        }
    }
public function ensureHasScale()
    {
        if (!$this->hasScales()) {
            $defaultScale = new Scale();
            $defaultScale->setName(
                $this->translator->trans('scale.default_name', [], 'competency')
            );
            $defaultLevel = new Level();
            $defaultLevel->setValue(0);
            $defaultLevel->setName(
                $this->translator->trans('scale.default_level_name', [], 'competency')
            );
            $defaultScale->setLevels(new ArrayCollection([$defaultLevel]));
            $this->om->persist($defaultScale);
            $this->om->flush();
        }
    }
public function ensureHasScale ( ) { if ( ! $ this -> hasScales ( ) ) { $ defaultScale = new Scale ( ) ; $ defaultScale -> setName ( $ this -> translator -> trans ( 'scale.default_name' , [ ] , 'competency' ) ) ; $ defaultLevel = new Level ( ) ; $ defaultLevel -> setValue ( 0 ) ; $ defaultLevel -> setName ( $ this -> translator -> trans ( 'scale.default_level_name' , [ ] , 'competency' ) ) ; $ defaultScale -> setLevels ( new ArrayCollection ( [ $ defaultLevel ] ) ) ; $ this -> om -> persist ( $ defaultScale ) ; $ this -> om -> flush ( ) ; } }
Creates a default scale if no scale exists yet.
Creates a default scale if no scale exists yet .