| @@ 98-109 (lines=12) @@ | ||
| 95 | ||
| 96 | // load class for entity if one is registered |
|
| 97 | $classname = get_subtype_class_from_id($row->subtype); |
|
| 98 | if ($classname != "") { |
|
| 99 | if (class_exists($classname)) { |
|
| 100 | $new_entity = new $classname($row); |
|
| 101 | ||
| 102 | if (!($new_entity instanceof \ElggEntity)) { |
|
| 103 | $msg = $classname . " is not a " . '\ElggEntity' . "."; |
|
| 104 | throw new \ClassException($msg); |
|
| 105 | } |
|
| 106 | } else { |
|
| 107 | error_log("Class '" . $classname . "' was not found, missing plugin?"); |
|
| 108 | } |
|
| 109 | } |
|
| 110 | ||
| 111 | if (!$new_entity) { |
|
| 112 | //@todo Make this into a function |
|
| @@ 2691-2700 (lines=10) @@ | ||
| 2688 | // Construct new class with owner from session |
|
| 2689 | $classname = get_subtype_class($class, $subclass); |
|
| 2690 | if ($classname) { |
|
| 2691 | if (class_exists($classname)) { |
|
| 2692 | $tmp = new $classname(); |
|
| 2693 | ||
| 2694 | if (!($tmp instanceof \ElggEntity)) { |
|
| 2695 | $msg = $classname . " is not a " . get_class() . "."; |
|
| 2696 | throw new \ClassException($msg); |
|
| 2697 | } |
|
| 2698 | } else { |
|
| 2699 | error_log("Class '" . $classname . "' was not found, missing plugin?"); |
|
| 2700 | } |
|
| 2701 | } else { |
|
| 2702 | switch ($class) { |
|
| 2703 | case 'object' : |
|