Hello,
I'd like to change a shared service on the fly, after being already resolved.
For eg:
$user1 = User::findFirstById(1);
$this->getDI()->setShared('user', $user1);
var_dump($this->getDI()->has('user')); // true
var_dump($this->user->getId()); // 1
$this->getDI()->remove('user');
var_dump($this->getDI()->has('user')); // false
$user2 = User::findFirstById(2);
$this->getDI()->setShared('user', $user2);
var_dump($this->getDI()->has('user')); // true
var_dump($this->user->getId()); // 1 !!!
As you can see, even though removing and setting a new definition, it still returns the id of the first set user.
Any help/advice is appreciated!
EDIT:
Since then I've tried setRaw("user", new Service("user", $user2, true))
to no avail