Permalink
Browse files

fix(core): get class from subclass instead of base

Now when a plugin extends the ElggObject and something goes wrong, it shows the class that extended the ElggObject, instead of "ElggObject".
  • Loading branch information...
Wouter0100 committed Mar 21, 2016
1 parent b96c736 commit 8b3e17facef15a0349401695408c7b0faf3ed594
Showing with 2 additions and 2 deletions.
  1. +2 −2 engine/classes/ElggObject.php
@@ -72,14 +72,14 @@ public function __construct($row = null) {
if ($row instanceof \stdClass) {
// Load the rest
if (!$this->load($row)) {
$msg = "Failed to load new " . get_class() . " for GUID: " . $row->guid;
$msg = "Failed to load new " . get_class($this) . " for GUID: " . $row->guid;
throw new \IOException($msg);
}
} else if (is_numeric($row)) {
// $row is a GUID so load
elgg_deprecated_notice('Passing a GUID to constructor is deprecated. Use get_entity()', 1.9);
if (!$this->load($row)) {
throw new \IOException("Failed to load new " . get_class() . " from GUID:" . $row);
throw new \IOException("Failed to load new " . get_class($this) . " from GUID:" . $row);
}
} else {
throw new \InvalidParameterException("Unrecognized value passed to constuctor.");

0 comments on commit 8b3e17f

Please sign in to comment.