File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
libs/model/datasources/dbo Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -727,8 +727,8 @@ function resultSet(&$results) {
727
727
$ j = 0 ;
728
728
729
729
while ($ j < $ numFields ) {
730
- $ column = mysql_fetch_field ($ results ,$ j );
731
- if (!empty ($ column ->table )) {
730
+ $ column = mysql_fetch_field ($ results , $ j );
731
+ if (!empty ($ column ->table ) && strpos ( $ column -> name , ' __ ' ) === false ) {
732
732
$ this ->map [$ index ++] = array ($ column ->table , $ column ->name );
733
733
} else {
734
734
$ this ->map [$ index ++] = array (0 , $ column ->name );
Original file line number Diff line number Diff line change @@ -7293,6 +7293,21 @@ function testVirtualFields() {
7293
7293
$ this ->assertTrue (isset ($ result ['Author ' ]['full_name ' ]));
7294
7294
}
7295
7295
7296
+ /**
7297
+ * test that virtual fields work when they don't contain functions.
7298
+ *
7299
+ * @return void
7300
+ */
7301
+ function testVirtualFieldAsAString () {
7302
+ $ this ->loadFixtures ('Post ' , 'Author ' );
7303
+ $ Post =& new Post ();
7304
+ $ Post ->virtualFields = array (
7305
+ 'writer ' => 'Author.user '
7306
+ );
7307
+ $ result = $ Post ->find ('first ' );
7308
+ $ this ->assertTrue (isset ($ result ['Post ' ]['writer ' ]), 'virtual field not fetched %s ' );
7309
+ }
7310
+
7296
7311
/**
7297
7312
* test that isVirtualField will accept both aliased and non aliased fieldnames
7298
7313
*
You can’t perform that action at this time.
0 commit comments