Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
esokullu committed Apr 26, 2018
1 parent 3742620 commit a9e603c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/Pho/Kernel/Hooks/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Pho\Kernel\Hooks;

use Pho\Lib\Graph\EdgeInterface;

/**
* {@inheritDoc}
*/
Expand All @@ -12,9 +14,10 @@ class Notification
*/
public static function setup(\Pho\Framework\AbstractNotification $notification): void
{
$notification->hook("edge", (function(string $edge_id) {
$notification->hook("edge", (function(): EdgeInterface
{
$this->_ensureKernel();
return $this->kernel->gs()->edge($this->edge_id);
return $this->owner->kernel()->gs()->edge($this->edge_id->toString());
})
);
}
Expand Down
13 changes: 9 additions & 4 deletions src/Pho/Kernel/Traits/Node/PersistentTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,15 @@ public function unserialize(/* mixed */ $data): void
if(!class_exists($class) || !preg_match("/^[a-z0-9_\\\\]+$/i", $class)) {
continue;
}
$edge_id = (string) ID::fromString($notification["edge"]);
$edge = $this->kernel->gs()->edge($edge_id);
$notifications[] = new $class($edge);
Hooks::setup($notifications[(count($notifications)-1)]);
$edge_id = ID::fromString($notification["edge"]);
//$edge = $this->kernel->gs()->edge($edge_id);
$notification = \ReflectionClass::newInstanceWithoutConstructor($class);// new $class($edge);
$n_ = new \ReflectionObject($notification);
$property = $n_->getProperty("edge_id");
$property->setAccessible(true);
$property->setValue($notification, $edge_id);
Hooks::setup($notification);
$notifications[] = $notification;
}
}
$this->notifications = new Framework\NotificationList($this, $notifications); // assuming it's an actor
Expand Down

0 comments on commit a9e603c

Please sign in to comment.