lib/Persistence/Doctrine/QueryHandler/LayoutQueryHandler.php
public function layoutNameExists(string $name, $excludedLayoutId = null): bool
    {
        $query = $this->connection->createQueryBuilder();
        $query->select('count(*) AS count')
            ->from('ngbm_layout')
            ->where(
                $query->expr()->andX(
                    $query->expr()->eq('name', ':name')
                )
            )
            ->setParameter('name', trim($name), Type::STRING);

        if ($excludedLayoutId !== null) {
            $query->andWhere($query->expr()->neq('id', ':layout_id'))
                ->setParameter('layout_id', $excludedLayoutId, Type::INTEGER);
        }

        $data = $query->execute()->fetchAll(PDO::FETCH_ASSOC);

        return (int) ($data[0]['count'] ?? 0) > 0;
    }
public function layoutNameExists(string $name, $excludedLayoutId = null): bool
    {
        $query = $this->connection->createQueryBuilder();
        $query->select('count(*) AS count')
            ->from('ngbm_layout')
            ->where(
                $query->expr()->andX(
                    $query->expr()->eq('name', ':name')
                )
            )
            ->setParameter('name', trim($name), Type::STRING);

        if ($excludedLayoutId !== null) {
            $query->andWhere($query->expr()->neq('id', ':layout_id'))
                ->setParameter('layout_id', $excludedLayoutId, Type::INTEGER);
        }

        $data = $query->execute()->fetchAll(PDO::FETCH_ASSOC);

        return (int) ($data[0]['count'] ?? 0) > 0;
    }
public function layoutNameExists ( string $ name , $ excludedLayoutId = null ) : bool { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> select ( 'count(*) AS count' ) -> from ( 'ngbm_layout' ) -> where ( $ query -> expr ( ) -> andX ( $ query -> expr ( ) -> eq ( 'name' , ':name' ) ) ) -> setParameter ( 'name' , trim ( $ name ) , Type :: STRING ) ; if ( $ excludedLayoutId !== null ) { $ query -> andWhere ( $ query -> expr ( ) -> neq ( 'id' , ':layout_id' ) ) -> setParameter ( 'layout_id' , $ excludedLayoutId , Type :: INTEGER ) ; } $ data = $ query -> execute ( ) -> fetchAll ( PDO :: FETCH_ASSOC ) ; return ( int ) ( $ data [ 0 ] [ 'count' ] ?? 0 ) > 0 ; }
Returns if the layout with provided name exists.

@param string $name
@param int|string $excludedLayoutId

@return bool
Returns if the layout with provided name exists .