Skip to content

Self-removal of SessionStores

Pre-release
Pre-release

Choose a tag to compare

@g105b g105b released this 22 Feb 14:54
· 106 commits to master since this release
92f0497

On a SessionStore object, there was already a remove() function, but this function only allowed for removing a child of the session store.

For instances where a SessionStore has been passed to a class for encapsulated session usage, it would be useful for that class to be able to remove the SessionStore itself. This could be done like this:

$encapsulatedSession = $session->get("example.auth");
$authentication = new Auth($encapsulatedSession);

// Inside Auth:

function logout() {
    $this->encapsulatedSession->remove();
}

Note that the above example calls remove() with no parameters, indicating that we want to remove the store itself (and all children).