Ejemplo n.º 1
0
 /**
  * @inheritdoc
  */
 protected function getSelectSecurityIdentityIdSql(SecurityIdentityInterface $sid)
 {
     if ($sid instanceof UserSecurityIdentity) {
         $identifier = $sid->getClass() . '-' . $sid->getUsername();
         $username = true;
     } elseif ($sid instanceof RoleSecurityIdentity) {
         $identifier = $sid->getRole();
         $username = false;
     } elseif ($sid instanceof JournalRoleSecurityIdentity) {
         $identifier = $sid->getIdentifier();
         $username = false;
     } else {
         throw new \InvalidArgumentException('$sid must either be an instance of UserSecurityIdentity, JournalRoleSecurityIdentity or RoleSecurityIdentity.');
     }
     return sprintf('SELECT id FROM %s WHERE identifier = %s AND username = %s', $this->options['sid_table_name'], $this->connection->quote($identifier), $this->connection->getDatabasePlatform()->convertBooleans($username));
 }