7
7
/**
8
8
* An excel sheet that is rendered with data from an `ActiveQuery`.
9
9
* A query must be set with `setQuery()`.
10
+ *
11
+ * Note that for backwards compatibility this class still uses 0-based column
12
+ * indices for its configuration properties while PhpSpreadsheet now is 1-based.
10
13
*/
11
14
class ActiveExcelSheet extends ExcelSheet
12
15
{
@@ -58,7 +61,7 @@ public function getData()
58
61
}
59
62
60
63
/**
61
- * @return string[] list of attributes for the table columns. If no
64
+ * @return string[] 0-based list of attributes for the table columns. If no
62
65
* attributes are set, attributes are set to `ActiveRecord::attributes()`
63
66
* for the main query record.
64
67
*/
@@ -71,7 +74,7 @@ public function getAttributes()
71
74
}
72
75
73
76
/**
74
- * @param string[] $value list of attributes for the table columns
77
+ * @param string[] $value 0-based list of attributes for the table columns
75
78
*/
76
79
public function setAttributes ($ value )
77
80
{
@@ -130,8 +133,8 @@ public function getFormats()
130
133
{
131
134
if ($ this ->_formats === null ) {
132
135
$ this ->_formats = [];
133
- $ attrs = $ this ->normalizeIndex ( $ this -> getAttributes () );
134
- $ schemas = $ this ->normalizeIndex ( $ this -> getColumnSchemas () );
136
+ $ attrs = $ this ->getAttributes ();
137
+ $ schemas = $ this ->getColumnSchemas ();
135
138
foreach ($ attrs as $ c => $ attr ) {
136
139
if (!isset ($ schemas [$ c ])) {
137
140
continue ;
@@ -176,15 +179,15 @@ public function setFormats($value)
176
179
177
180
/**
178
181
* @return Callable[] the value formatters for the column cells indexed by
179
- * 0-based column index. If not set, the formatters are aut -generated from
182
+ * 0-based column index. If not set, the formatters are auto -generated from
180
183
* the DB column types.
181
184
*/
182
185
public function getFormatters ()
183
186
{
184
187
if ($ this ->_formatters === null ) {
185
188
$ this ->_formatters = [];
186
- $ attrs = $ this ->normalizeIndex ( $ this -> getAttributes () );
187
- $ schemas = $ this ->normalizeIndex ( $ this -> getColumnSchemas () );
189
+ $ attrs = $ this ->getAttributes ();
190
+ $ schemas = $ this ->getColumnSchemas ();
188
191
foreach ($ attrs as $ c => $ attr ) {
189
192
if (!isset ($ schemas [$ c ])) {
190
193
continue ;
0 commit comments