File tree Expand file tree Collapse file tree 1 file changed +8
-19
lines changed
app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider/CategoryTree/Wrapper Expand file tree Collapse file tree 1 file changed +8
-19
lines changed Original file line number Diff line number Diff line change @@ -49,21 +49,21 @@ public function __construct(Hydrator $hydrator)
49
49
*/
50
50
public function wrap (Category $ category ): void
51
51
{
52
- if (!$ this ->hasNode ( self ::TOP_NODE_ID )) {
52
+ if (!isset ( $ this ->index [ self ::TOP_NODE_ID ] )) {
53
53
$ this ->index [self ::TOP_NODE_ID ] = new Node (self ::TOP_NODE_ID );
54
54
}
55
55
$ parentId = self ::TOP_NODE_ID ;
56
56
array_map (
57
57
function ($ id ) use (&$ parentId , $ category ) {
58
58
$ id = (int )$ id ;
59
- if (!$ this ->hasNode ( $ id )) {
59
+ if (!isset ( $ this ->index [ $ id] )) {
60
60
$ this ->index [$ id ] = new Node ($ id );
61
- }
62
- $ this ->index [$ parentId ]->addChild ( $ this -> index [ $ id ]);
63
- if ( $ category -> getId () == $ id ) {
64
- $ this -> index [ $ id ]-> setModelData (
65
- $ this -> hydrator -> hydrateCategory ( $ category )
66
- );
61
+ if ( $ category -> getId () == $ id ) {
62
+ $ this ->index [$ id ]->setModelData (
63
+ $ this -> hydrator -> hydrateCategory ( $ category )
64
+ );
65
+ }
66
+ $ this -> index [ $ parentId ]-> addChild ( $ this -> index [ $ id ] );
67
67
}
68
68
$ parentId = $ id ;
69
69
},
@@ -81,15 +81,4 @@ public function getNode(int $id) : ?Node
81
81
{
82
82
return $ this ->index [$ id ] ?? null ;
83
83
}
84
-
85
- /**
86
- * Check whether the node is indexed.
87
- *
88
- * @param int $id
89
- * @return bool
90
- */
91
- public function hasNode (int $ id ) : bool
92
- {
93
- return isset ($ this ->index [$ id ]);
94
- }
95
84
}
You can’t perform that action at this time.
0 commit comments