Self-removal of SessionStores
Pre-release
Pre-release
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).