src/components/CategoryManager.php
public function init ()
		{
			$class = $this->_modelClass;

			$this->_root = $class::find()->roots()->one();
			if ($this->_root == null)
			{
				$root = new $class([ 'guid' => 'root', 'title' => 'ROOT' ]);
				$root->makeRoot();

				$this->_root = $class::find()->roots()->one();
				$this->_data = [];
			}
			else
				$this->_data = $this->_root->children()->all();

			$this->buildPaths();
		}
public function init ()
		{
			$class = $this->_modelClass;

			$this->_root = $class::find()->roots()->one();
			if ($this->_root == null)
			{
				$root = new $class([ 'guid' => 'root', 'title' => 'ROOT' ]);
				$root->makeRoot();

				$this->_root = $class::find()->roots()->one();
				$this->_data = [];
			}
			else
				$this->_data = $this->_root->children()->all();

			$this->buildPaths();
		}
public function init ( ) { $ class = $ this -> _modelClass ; $ this -> _root = $ class :: find ( ) -> roots ( ) -> one ( ) ; if ( $ this -> _root == null ) { $ root = new $ class ( [ 'guid' => 'root' , 'title' => 'ROOT' ] ) ; $ root -> makeRoot ( ) ; $ this -> _root = $ class :: find ( ) -> roots ( ) -> one ( ) ; $ this -> _data = [ ] ; } else $ this -> _data = $ this -> _root -> children ( ) -> all ( ) ; $ this -> buildPaths ( ) ; }
Populates category tree with data loaded from database.
@inheritdoc
Populates category tree with data loaded from database .