⇦ Back to MetadataManager classMethod createRecordIfNonExisting
public void
createRecordIfNonExisting
(\Joomla\Session\SessionInterface $session, \Joomla\CMS\User\User $user)
Create the metadata record if it does not exist.
Parameters
- \Joomla\Session\SessionInterface $session The session to create the metadata record for.
- \Joomla\CMS\User\User $user The user to associate with the record.
Returns
Since
-
Method createRecordIfNonExisting - Source code
/**
* Create the metadata record if it does not exist.
*
* @param SessionInterface $session The session to create the metadata record for.
* @param User $user The user to associate with the record.
*
* @return void
*
* @since 3.8.6
* @throws \RuntimeException
*/
public function createRecordIfNonExisting(SessionInterface $session, User $user)
{
$exists = $this->checkSessionRecordExists($session->getId());
// Only touch the database if the record does not already exist
if ($exists !== self::$sessionRecordExists) {
return;
}
$this->createSessionRecord($session, $user);
}