protected function getInsertSecurityIdentitySql(SecurityIdentityInterface $sid)
    {
        if ($sid instanceof UserSecurityIdentity) {
            $identifier = $sid->getClass().'-'.$sid->getUsername();
            $username = true;
        } elseif ($sid instanceof RoleSecurityIdentity) {
            $identifier = $sid->getRole();
            $username = false;
        } else {
            throw new \InvalidArgumentException('$sid must either be an instance of UserSecurityIdentity, or RoleSecurityIdentity.');
        }

        return sprintf(
            'INSERT INTO %s (identifier, username) VALUES (%s, %s)',
            $this->options['sid_table_name'],
            $this->connection->quote($identifier),
            $this->connection->getDatabasePlatform()->convertBooleans($username)
        );
    }
protected function getInsertSecurityIdentitySql(SecurityIdentityInterface $sid)
    {
        if ($sid instanceof UserSecurityIdentity) {
            $identifier = $sid->getClass().'-'.$sid->getUsername();
            $username = true;
        } elseif ($sid instanceof RoleSecurityIdentity) {
            $identifier = $sid->getRole();
            $username = false;
        } else {
            throw new \InvalidArgumentException('$sid must either be an instance of UserSecurityIdentity, or RoleSecurityIdentity.');
        }

        return sprintf(
            'INSERT INTO %s (identifier, username) VALUES (%s, %s)',
            $this->options['sid_table_name'],
            $this->connection->quote($identifier),
            $this->connection->getDatabasePlatform()->convertBooleans($username)
        );
    }
protected function getInsertSecurityIdentitySql ( SecurityIdentityInterface $ sid ) { if ( $ sid instanceof UserSecurityIdentity ) { $ identifier = $ sid -> getClass ( ) . '-' . $ sid -> getUsername ( ) ; $ username = true ; } elseif ( $ sid instanceof RoleSecurityIdentity ) { $ identifier = $ sid -> getRole ( ) ; $ username = false ; } else { throw new \ InvalidArgumentException ( '$sid must either be an instance of UserSecurityIdentity, or RoleSecurityIdentity.' ) ; } return sprintf ( 'INSERT INTO %s (identifier, username) VALUES (%s, %s)' , $ this -> options [ 'sid_table_name' ] , $ this -> connection -> quote ( $ identifier ) , $ this -> connection -> getDatabasePlatform ( ) -> convertBooleans ( $ username ) ) ; }
Constructs the SQL for inserting a security identity.

@param SecurityIdentityInterface $sid

@throws \InvalidArgumentException

@return string
Constructs the SQL for inserting a security identity .