Code Duplication    Length = 20-21 lines in 5 locations

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

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

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

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