additional modifications for #15
Dieser Commit ist enthalten in:
Ursprung
603ce348eb
Commit
c0909ffb2d
|
@ -112,6 +112,12 @@ abstract class ItemCollection extends cItemBaseAbstract {
|
||||||
*/
|
*/
|
||||||
protected $_resultFields = array();
|
protected $_resultFields = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var array Column names of db table
|
||||||
|
*/
|
||||||
|
protected $_aTableColums = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Encoding
|
* @var string Encoding
|
||||||
*/
|
*/
|
||||||
|
@ -624,6 +630,7 @@ abstract class ItemCollection extends cItemBaseAbstract {
|
||||||
$this->_where['groups'] = array();
|
$this->_where['groups'] = array();
|
||||||
$this->_groupConditions = array();
|
$this->_groupConditions = array();
|
||||||
$this->_resultFields = array();
|
$this->_resultFields = array();
|
||||||
|
$this->_aTableColums = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -708,11 +715,16 @@ abstract class ItemCollection extends cItemBaseAbstract {
|
||||||
* Adds a result field
|
* Adds a result field
|
||||||
* @param string|array $mField
|
* @param string|array $mField
|
||||||
*/
|
*/
|
||||||
public function addResultField($mField) {
|
public function addResultField($mField, $bAll = false) {
|
||||||
if (!is_array($mField)) {
|
if (!empty($mField) && !is_array($mField)) {
|
||||||
$mField = array($mField);
|
$mField = array($mField);
|
||||||
|
} else if($bAll && empty($this->_aTableColums)) {
|
||||||
|
$aTemp = $this->db->metadata($this->table);
|
||||||
|
foreach ($aTemp as $aMeta) {
|
||||||
|
$this->_aTableColums[] = $aMeta['name'];
|
||||||
|
}
|
||||||
|
$mField = $this->_aTableColums;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($mField as $sField) {
|
foreach ($mField as $sField) {
|
||||||
$sField = strtolower($sField);
|
$sField = strtolower($sField);
|
||||||
if (!in_array($sField, $this->_resultFields)) {
|
if (!in_array($sField, $this->_resultFields)) {
|
||||||
|
@ -955,6 +967,10 @@ abstract class ItemCollection extends cItemBaseAbstract {
|
||||||
$row = 1;
|
$row = 1;
|
||||||
$aTable = array();
|
$aTable = array();
|
||||||
|
|
||||||
|
if(!empty($this->_aTableColums)) {
|
||||||
|
$aFields = $this->_aTableColums;
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($aFields) && empty($aObjects)) {
|
if (empty($aFields) && empty($aObjects)) {
|
||||||
$aFields = array($this->primaryKey);
|
$aFields = array($this->primaryKey);
|
||||||
}
|
}
|
||||||
|
|
Laden…
In neuem Issue referenzieren