ZF-3306: A Method is not implement in a good way in Zend_Db_Table_Row_Abstract


This method:

     * Sets all data in the row from an array.
     * @param  array $data
     * @return Zend_Db_Table_Row_Abstract Provides a fluent interface
    public function setFromArray(array $data)
        foreach ($data as $columnName => $value) {
            $this->$columnName = $value;

        return $this;

This method enable you to set several columns in a single row at once, specified in an associative array that maps the column names to values. You may find this method convenient for setting values both for new rows and for rows you need to update.But it isn't impement in a good way. Let's look at this line: {color:red} $this->$columnName = $value;{color} What it want to do is to use the magic method __set() to set values for the property var $_data.But,in some cases,the argument array may contains a key named the same as some of the property.For example:I have a table filed that it's name is '_data' or others like '_table' , '_connected'. Then this method won't work as we expect it to, and we can hardly notice this unless we read the source code.Why we don't use the magic method __set directly. Like this: {color:red} $this->__set( $columnName , $value){color} It's a better way for this method..


At first glance, that seems right to me.

?How to say?

Outside the class,only public property are consider exist. But,inside the class,all properties include private and protected are consider exist. So, magic method outside the class do not work the same as inside the class.

Please evaluate and categorize as necessary.

Fixed at r10267