Code Duplication    Length = 20-21 lines in 5 locations

eZ/Publish/Core/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabase.php 3 locations

@@ 65-85 (lines=21) @@
62
     *
63
     * @return array
64
     */
65
    public function getBasicNodeData($nodeId)
66
    {
67
        $query = $this->handler->createSelectQuery();
68
        $query
69
            ->select('*')
70
            ->from($this->handler->quoteTable('ezcontentobject_tree'))
71
            ->where(
72
                $query->expr->eq(
73
                    $this->handler->quoteColumn('node_id'),
74
                    $query->bindValue($nodeId)
75
                )
76
            );
77
        $statement = $query->prepare();
78
        $statement->execute();
79
80
        if ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
81
            return $row;
82
        }
83
84
        throw new NotFound('location', $nodeId);
85
    }
86
87
    /**
88
     * Returns an array with basic node data.
@@ 96-116 (lines=21) @@
93
     *
94
     * @return array
95
     */
96
    public function getBasicNodeDataByRemoteId($remoteId)
97
    {
98
        $query = $this->handler->createSelectQuery();
99
        $query
100
            ->select('*')
101
            ->from($this->handler->quoteTable('ezcontentobject_tree'))
102
            ->where(
103
                $query->expr->eq(
104
                    $this->handler->quoteColumn('remote_id'),
105
                    $query->bindValue($remoteId)
106
                )
107
            );
108
        $statement = $query->prepare();
109
        $statement->execute();
110
111
        if ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
112
            return $row;
113
        }
114
115
        throw new NotFound('location', $remoteId);
116
    }
117
118
    /**
119
     * Loads data for all Locations for $contentId, optionally only in the
@@ 1220-1240 (lines=21) @@
1217
     *
1218
     * @return array
1219
     */
1220
    public function loadTrashByLocation($locationId)
1221
    {
1222
        $query = $this->handler->createSelectQuery();
1223
        $query
1224
            ->select('*')
1225
            ->from($this->handler->quoteTable('ezcontentobject_trash'))
1226
            ->where(
1227
                $query->expr->eq(
1228
                    $this->handler->quoteColumn('node_id'),
1229
                    $query->bindValue($locationId)
1230
                )
1231
            );
1232
        $statement = $query->prepare();
1233
        $statement->execute();
1234
1235
        if ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
1236
            return $row;
1237
        }
1238
1239
        throw new NotFound('trash', $locationId);
1240
    }
1241
1242
    /**
1243
     * List trashed items.

eZ/Publish/Core/Persistence/Legacy/Content/Type/Gateway/DoctrineDatabase.php 2 locations

@@ 916-935 (lines=20) @@
913
     *
914
     * @return array(int=>array(string=>mixed)) Data rows.
915
     */
916
    public function loadTypeDataByIdentifier($identifier, $status)
917
    {
918
        $q = $this->getLoadTypeQuery();
919
        $q->where(
920
            $q->expr->lAnd(
921
                $q->expr->eq(
922
                    $this->dbHandler->quoteColumn('identifier', 'ezcontentclass'),
923
                    $q->bindValue($identifier)
924
                ),
925
                $q->expr->eq(
926
                    $this->dbHandler->quoteColumn('version', 'ezcontentclass'),
927
                    $q->bindValue($status)
928
                )
929
            )
930
        );
931
        $stmt = $q->prepare();
932
        $stmt->execute();
933
934
        return $stmt->fetchAll(\PDO::FETCH_ASSOC);
935
    }
936
937
    /**
938
     * Loads an array with data about the type referred to by $remoteId in
@@ 946-965 (lines=20) @@
943
     *
944
     * @return array(int=>array(string=>mixed)) Data rows.
945
     */
946
    public function loadTypeDataByRemoteId($remoteId, $status)
947
    {
948
        $q = $this->getLoadTypeQuery();
949
        $q->where(
950
            $q->expr->lAnd(
951
                $q->expr->eq(
952
                    $this->dbHandler->quoteColumn('remote_id', 'ezcontentclass'),
953
                    $q->bindValue($remoteId)
954
                ),
955
                $q->expr->eq(
956
                    $this->dbHandler->quoteColumn('version', 'ezcontentclass'),
957
                    $q->bindValue($status)
958
                )
959
            )
960
        );
961
        $stmt = $q->prepare();
962
        $stmt->execute();
963
964
        return $stmt->fetchAll(\PDO::FETCH_ASSOC);
965
    }
966
967
    /**
968
     * Returns a basic query to retrieve Type data.