Code Duplication    Length = 21-21 lines in 4 locations

htdocs/src/Oc/Country/CountryRepository.php 1 location

@@ 46-66 (lines=21) @@
43
     *
44
     * @throws RecordsNotFoundException Thrown when no records are found
45
     */
46
    public function fetchAll()
47
    {
48
        $statement = $this->connection->createQueryBuilder()
49
            ->select('*')
50
            ->from(self::TABLE)
51
            ->execute();
52
53
        $result = $statement->fetchAll();
54
55
        if ($statement->rowCount() === 0) {
56
            throw new RecordsNotFoundException('No records found');
57
        }
58
59
        $countries = [];
60
61
        foreach ($result as $item) {
62
            $countries[] = $this->getEntityFromDatabaseArray($item);
63
        }
64
65
        return $countries;
66
    }
67
68
    /**
69
     * Creates a country in the database.

htdocs/src/Oc/FieldNotes/Persistence/FieldNoteRepository.php 1 location

@@ 55-75 (lines=21) @@
52
     *
53
     * @throws RecordsNotFoundException Thrown when no records are found
54
     */
55
    public function fetchAll()
56
    {
57
        $statement = $this->connection->createQueryBuilder()
58
            ->select('*')
59
            ->from(self::TABLE)
60
            ->execute();
61
62
        $result = $statement->fetchAll();
63
64
        if ($statement->rowCount() === 0) {
65
            throw new RecordsNotFoundException('No records found');
66
        }
67
68
        $entities = [];
69
70
        foreach ($result as $item) {
71
            $entities[] = $this->getEntityFromDatabaseArray($item);
72
        }
73
74
        return $entities;
75
    }
76
77
    /**
78
     * Fetches all GeoCaches by given where clause.

htdocs/src/Oc/GeoCache/Persistence/GeoCache/GeoCacheRepository.php 1 location

@@ 49-69 (lines=21) @@
46
     *
47
     * @throws RecordsNotFoundException Thrown when no records are found
48
     */
49
    public function fetchAll()
50
    {
51
        $statement = $this->connection->createQueryBuilder()
52
            ->select('*')
53
            ->from(self::TABLE)
54
            ->execute();
55
56
        $result = $statement->fetchAll();
57
58
        if ($statement->rowCount() === 0) {
59
            throw new RecordsNotFoundException('No records found');
60
        }
61
62
        $records = [];
63
64
        foreach ($result as $item) {
65
            $records[] = $this->getEntityFromDatabaseArray($item);
66
        }
67
68
        return $records;
69
    }
70
71
    /**
72
     * Fetches a GeoCache by given where clause.

htdocs/src/Oc/GeoCache/Persistence/GeoCacheLog/GeoCacheLogRepository.php 1 location

@@ 48-68 (lines=21) @@
45
     *
46
     * @throws RecordsNotFoundException Thrown when no records are found
47
     */
48
    public function fetchAll()
49
    {
50
        $statement = $this->connection->createQueryBuilder()
51
            ->select('*')
52
            ->from(self::TABLE)
53
            ->execute();
54
55
        $result = $statement->fetchAll();
56
57
        if ($statement->rowCount() === 0) {
58
            throw new RecordsNotFoundException('No records found');
59
        }
60
61
        $records = [];
62
63
        foreach ($result as $item) {
64
            $records[] = $this->getEntityFromDatabaseArray($item);
65
        }
66
67
        return $records;
68
    }
69
70
    /**
71
     * Fetches a GeoCacheLog by given where clause.