Browse Source

Merge branch 'master' of github.com:cakephp/cakephp

Mark Story 8 years ago
parent
commit
c7e28d4117
3 changed files with 234 additions and 702 deletions
  1. 213 701
      config/cacert.pem
  2. 2 1
      src/ORM/Association.php
  3. 19 0
      tests/TestCase/ORM/QueryTest.php

File diff suppressed because it is too large
+ 213 - 701
config/cacert.pem


+ 2 - 1
src/ORM/Association.php

@@ -1143,7 +1143,8 @@ abstract class Association
         }
 
         if ($autoFields === true) {
-            $fields = array_merge((array)$fields, $target->getSchema()->columns());
+            $fields = array_filter((array)$fields);
+            $fields = array_merge($fields, $target->getSchema()->columns());
         }
 
         if ($fields) {

+ 19 - 0
tests/TestCase/ORM/QueryTest.php

@@ -3318,6 +3318,25 @@ class QueryTest extends TestCase
     }
 
     /**
+     * Tests that leftJoinWith() can be used with autofields()
+     *
+     * @return void
+     */
+    public function testLeftJoinWithAutoFields()
+    {
+        $table = TableRegistry::get('articles');
+        $table->belongsTo('authors');
+
+        $results = $table
+            ->find()
+            ->leftJoinWith('authors', function ($q) {
+                return $q->enableAutoFields(true);
+            })
+            ->all();
+        $this->assertCount(3, $results);
+    }
+
+    /**
      * Tests innerJoinWith()
      *
      * @return void