public function copyFrom ($data) {
        if (is_array ($data) || ($data instanceof \Traversable)) {
            if ($this->_count > 0)
                $this->clear ();
            if ($data instanceof CList)
                $data = $data->_data;
            foreach ($data as $item) {
                $this->add ($item);
            }
        } else if ($data !== null)
            throw new InvalidConfigException(Yii::t ('yii' , 'List data must be an array or an object implementing Traversable.'));
    }
public function copyFrom ($data) {
        if (is_array ($data) || ($data instanceof \Traversable)) {
            if ($this->_count > 0)
                $this->clear ();
            if ($data instanceof CList)
                $data = $data->_data;
            foreach ($data as $item) {
                $this->add ($item);
            }
        } else if ($data !== null)
            throw new InvalidConfigException(Yii::t ('yii' , 'List data must be an array or an object implementing Traversable.'));
    }
public function copyFrom ( $ data ) { if ( is_array ( $ data ) || ( $ data instanceof \ Traversable ) ) { if ( $ this -> _count > 0 ) $ this -> clear ( ) ; if ( $ data instanceof CList ) $ data = $ data -> _data ; foreach ( $ data as $ item ) { $ this -> add ( $ item ) ; } } else if ( $ data !== null ) throw new InvalidConfigException ( Yii :: t ( 'yii' , 'List data must be an array or an object implementing Traversable.' ) ) ; }
Copies iterable data into the list.
Note, existing data in the list will be cleared first.
@param mixed $data the data to be copied from, must be an array or object implementing Traversable
@throws InvalidConfigException If data is neither an array nor a Traversable.
Copies iterable data into the list . Note existing data in the list will be cleared first .