/** * Fetch and return the current row of this query's result * * @return object */ public function current() { $row = $this->iterator->current(); if ($this->repository->providesValueConversion($this->target)) { foreach ($this->getColumns() as $alias => $column) { if (!is_string($alias)) { $alias = $column; } $row->{$alias} = $this->repository->retrieveColumn($this->target, $alias, $row->{$alias}, $this); } } return $row; }
/** * Return whether this repository is capable of converting values for the given table and optional column * * This does not check whether any conversion for the given table is available if $column is not given, as it * may be possible that columns from another table where joined in which would otherwise not being converted. * * @param string $table * @param string $column * * @return bool */ public function providesValueConversion($table, $column = null) { if ($column !== null) { if ($column instanceof Zend_Db_Expr) { return false; } if ($this->validateQueryColumnAssociation($table, $column)) { return parent::providesValueConversion($table, $column); } if ($tableName = $this->findTableName($column)) { return parent::providesValueConversion($tableName, $column); } return false; } $conversionRules = $this->getConversionRules(); return !empty($conversionRules); }
/** * Return whether this repository is capable of converting values for the given table and optional column * * This does not check whether any conversion for the given table is available if $column is not given, as it * may be possible that columns from another table where joined in which would otherwise not being converted. * * @param array|string $table * @param string $column * * @return bool */ public function providesValueConversion($table, $column = null) { if ($column !== null) { if ($this->validateQueryColumnAssociation($table, $column)) { return parent::providesValueConversion($this->removeTablePrefix($this->clearTableAlias($table)), $column); } if ($tableName = $this->findTableName($column)) { return parent::providesValueConversion($tableName, $column); } return false; } $conversionRules = $this->getConversionRules(); return !empty($conversionRules); }