public function deleteUrlAliasesWithBrokenLink()
    {
        $existingAliasesQuery = $this->getAllUrlAliasesQuery();

        $query = $this->connection->createQueryBuilder();
        $query
            ->delete($this->table)
            ->where(
                $query->expr()->neq('id', 'link')
            )
            ->andWhere(
                $query->expr()->notIn(
                    'link',
                    $existingAliasesQuery
                )
            )
        ;

        return $query->execute();
    }
public function deleteUrlAliasesWithBrokenLink()
    {
        $existingAliasesQuery = $this->getAllUrlAliasesQuery();

        $query = $this->connection->createQueryBuilder();
        $query
            ->delete($this->table)
            ->where(
                $query->expr()->neq('id', 'link')
            )
            ->andWhere(
                $query->expr()->notIn(
                    'link',
                    $existingAliasesQuery
                )
            )
        ;

        return $query->execute();
    }
public function deleteUrlAliasesWithBrokenLink ( ) { $ existingAliasesQuery = $ this -> getAllUrlAliasesQuery ( ) ; $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> delete ( $ this -> table ) -> where ( $ query -> expr ( ) -> neq ( 'id' , 'link' ) ) -> andWhere ( $ query -> expr ( ) -> notIn ( 'link' , $ existingAliasesQuery ) ) ; return $ query -> execute ( ) ; }
Delete URL aliases which do not link to any existing URL alias node.

Note: Typically link column value is used to determine original alias for an archived entries.
Delete URL aliases which do not link to any existing URL alias node .