protected function initData()
    {
        if ($this->data !== null) {
            return;
        }

        if ($this->value !== null) {
            $this->data = $this->value;
            return;
        }

        if ($this->model instanceof Model) {
            $data = ($this->model->hasProperty($this->attribute) || isset($this->model->{$this->attribute}))
                ? ArrayHelper::getValue($this->model, $this->attribute, [])
                : [];

            if (!is_array($data) && empty($data)) {
                return;
            }

            if (!($data instanceof \Traversable)) {
                $data = (array) $data;
            }

            foreach ($data as $index => $value) {
                $this->data[$index] = $value;
            }
        }
    }
protected function initData()
    {
        if ($this->data !== null) {
            return;
        }

        if ($this->value !== null) {
            $this->data = $this->value;
            return;
        }

        if ($this->model instanceof Model) {
            $data = ($this->model->hasProperty($this->attribute) || isset($this->model->{$this->attribute}))
                ? ArrayHelper::getValue($this->model, $this->attribute, [])
                : [];

            if (!is_array($data) && empty($data)) {
                return;
            }

            if (!($data instanceof \Traversable)) {
                $data = (array) $data;
            }

            foreach ($data as $index => $value) {
                $this->data[$index] = $value;
            }
        }
    }
protected function initData ( ) { if ( $ this -> data !== null ) { return ; } if ( $ this -> value !== null ) { $ this -> data = $ this -> value ; return ; } if ( $ this -> model instanceof Model ) { $ data = ( $ this -> model -> hasProperty ( $ this -> attribute ) || isset ( $ this -> model -> { $ this -> attribute } ) ) ? ArrayHelper :: getValue ( $ this -> model , $ this -> attribute , [ ] ) : [ ] ; if ( ! is_array ( $ data ) && empty ( $ data ) ) { return ; } if ( ! ( $ data instanceof \ Traversable ) ) { $ data = ( array ) $ data ; } foreach ( $ data as $ index => $ value ) { $ this -> data [ $ index ] = $ value ; } } }
Initializes data.
Initializes data .