/** * extract only approved fields from a resultset * * @param \PhalconRest\API\Model $resultSet */ protected function loadAllowedColumns($resultSet) { $record = array(); $allowedFields = $resultSet->getAllowedColumns(false); foreach ($allowedFields as $field) { if (isset($resultSet->{$field})) { $record[$field] = $resultSet->{$field}; } else { // error, field doesn't exist on resultSet! $record[$field] = null; } } return $record; }
/** * extract only approved fields from a resultset * * @param \PhalconRest\API\Model $resultSet */ protected function loadAllowedColumns($resultSet) { $record = array(); // $allowedFields = $model->getAllowedColumns(false); $allowedFields = $resultSet->getAllowedColumns(false); foreach ($allowedFields as $field) { $record[$field] = $resultSet->{$field}; } return $record; }