Code Duplication    Length = 14-15 lines in 2 locations

eZ/Publish/Core/Persistence/Legacy/Bookmark/Gateway/DoctrineDatabase.php 1 location

@@ 89-103 (lines=15) @@
86
    /**
87
     * {@inheritdoc}
88
     */
89
    public function loadBookmarkDataByUserIdAndLocationId(int $userId, array $locationIds): array
90
    {
91
        $query = $this->connection->createQueryBuilder();
92
        $query
93
            ->select(...$this->getColumns())
94
            ->from(self::TABLE_BOOKMARKS)
95
            ->where($query->expr()->andX(
96
                $query->expr()->eq(self::COLUMN_USER_ID, ':user_id'),
97
                $query->expr()->in(self::COLUMN_LOCATION_ID, ':location_id')
98
            ))
99
            ->setParameter(':user_id', $userId, PDO::PARAM_INT)
100
            ->setParameter(':location_id', $locationIds, Connection::PARAM_INT_ARRAY);
101
102
        return $query->execute()->fetchAll(PDO::FETCH_ASSOC);
103
    }
104
105
    /**
106
     * {@inheritdoc}

eZ/Publish/Core/Persistence/Legacy/UserPreference/Gateway/DoctrineDatabase.php 1 location

@@ 77-90 (lines=14) @@
74
        return (int) $this->connection->lastInsertId();
75
    }
76
77
    public function getUserPreferenceByUserIdAndName(int $userId, string $name): array
78
    {
79
        $query = $this->connection->createQueryBuilder();
80
        $query
81
            ->select(...$this->getColumns())
82
            ->from(self::TABLE_USER_PREFERENCES)
83
            ->where($query->expr()->eq(self::COLUMN_USER_ID, ':userId'))
84
            ->andWhere($query->expr()->eq(self::COLUMN_NAME, ':name'));
85
86
        $query->setParameter(':userId', $userId, ParameterType::INTEGER);
87
        $query->setParameter(':name', $name, ParameterType::STRING);
88
89
        return $query->execute()->fetchAll(FetchMode::ASSOCIATIVE);
90
    }
91
92
    /**
93
     * {@inheritdoc}