diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2015-03-19 22:58:00 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2015-03-19 22:58:00 +0300 |
commit | 46603d8e57e0c231343cb8a2c35e78aa7ba7d4a3 (patch) | |
tree | 88a07d94574dcab940925a49053bacc0bd89644d /core/DataTable.php | |
parent | aead5ce7f2ab61c786799a411cdc69120fe4550e (diff) |
further dataTable performance improvements
Diffstat (limited to 'core/DataTable.php')
-rw-r--r-- | core/DataTable.php | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/core/DataTable.php b/core/DataTable.php index 2e94d5e89e..6a76350fd6 100644 --- a/core/DataTable.php +++ b/core/DataTable.php @@ -591,9 +591,6 @@ class DataTable implements DataTableInterface, \IteratorAggregate, \ArrayAccess public function getRowFromLabel($label) { $rowId = $this->getRowIdFromLabel($label); - if ($rowId instanceof Row) { - return $rowId; - } if (is_int($rowId) && isset($this->rows[$rowId])) { return $this->rows[$rowId]; } @@ -602,6 +599,9 @@ class DataTable implements DataTableInterface, \IteratorAggregate, \ArrayAccess ) { return $this->summaryRow; } + if ($rowId instanceof Row) { + return $rowId; + } return false; } @@ -626,7 +626,8 @@ class DataTable implements DataTableInterface, \IteratorAggregate, \ArrayAccess return self::ID_SUMMARY_ROW; } - $label = (string)$label; + $label = (string) $label; + if (!isset($this->rowsIndexByLabel[$label])) { return false; } @@ -657,12 +658,19 @@ class DataTable implements DataTableInterface, \IteratorAggregate, \ArrayAccess { $this->rebuildIndexContinuously = true; - foreach ($this->getRows() as $id => $row) { + foreach ($this->rows as $id => $row) { $label = $row->getColumn('label'); if ($label !== false) { $this->rowsIndexByLabel[$label] = $id; } } + if ($this->summaryRow) { + $label = $this->summaryRow->getColumn('label'); + if ($label !== false) { + $this->rowsIndexByLabel[$label] = DataTable::ID_SUMMARY_ROW; + } + } + $this->indexNotUpToDate = false; } |