/** * * Returns the struct value for the current iterator position. * * @return mixed * */ public function current() { return $this->_struct->__get($this->key()); }
/** * * Magic getter for record properties; automatically calls __getColName() * methods when they exist. * * @param string $key The property name. * * @return mixed The property value. * */ public function __get($key) { $found = array_key_exists($key, $this->_data); if (!$found && !empty($this->_model->related[$key])) { // the key is for a related that has no data yet. // get the relationship object and get the related object $related = $this->_model->getRelated($key); $this->_data[$key] = $related->fetch($this); } // if an accessor method exists, use it if (!empty($this->_access_methods[$key]['get'])) { // use accessor method $method = $this->_access_methods[$key]['get']; return $this->{$method}(); } else { // no accessor method; use parent method. return parent::__get($key); } }