We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f602add + f2a5593 commit 8f0bf49Copy full SHA for 8f0bf49
src/Traits/EntityTrait.php
@@ -16,7 +16,7 @@ public function __get(string $key)
16
// First check the framework's version
17
$result = parent::__get($key);
18
19
- if ($result !== null)
+ if ($result !== null || array_key_exists($key, $this->attributes))
20
{
21
return $result;
22
}
tests/entity/MagicTest.php
@@ -23,6 +23,18 @@ public function testGetIgnoresUnmatched()
23
24
$this->assertNull($this->factory->racecars);
25
26
+
27
+ public function testGetRespectsNull()
28
+ {
29
+ $machine = new Machine([
30
+ 'factory_id' => 1,
31
+ 'factory' => null,
32
+ ]);
33
34
+ $result = $machine->factory;
35
36
+ $this->assertNull($result);
37
+ }
38
39
public function testRequiresProperties()
40
0 commit comments