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 d033806 + e42909f commit 459d721Copy full SHA for 459d721
src/Traits/EntityTrait.php
@@ -76,6 +76,8 @@ public function __isset(string $key): bool
76
*/
77
public function __call(string $name, array $arguments)
78
{
79
+ $this->_verifyRelatable();
80
+
81
$verbs = ['has', 'set', 'add', 'remove'];
82
83
// Parse the name to check for supported relation verbs
@@ -153,6 +155,12 @@ public function __call(string $name, array $arguments)
153
155
154
156
public function relations(string $tableName, $keysOnly = false)
157
158
+ // If entity primary key is not set then finish
159
+ if (! isset($this->attributes[$this->primaryKey]))
160
+ {
161
+ return null;
162
+ }
163
164
// Use BaseTrait to get related items
165
$items = $this->_getRelations($tableName);
166
0 commit comments