| @@ 324-354 (lines=31) @@ | ||
| 321 | * |
|
| 322 | * @return ExpandedProjectionNode|null |
|
| 323 | */ |
|
| 324 | protected function getCurrentExpandedProjectionNode() |
|
| 325 | { |
|
| 326 | $expandedProjectionNode = $this->request->getRootProjectionNode(); |
|
| 327 | if (is_null($expandedProjectionNode)) { |
|
| 328 | return null; |
|
| 329 | } else { |
|
| 330 | $depth = count($this->_segmentNames); |
|
| 331 | // $depth == 1 means serialization of root entry |
|
| 332 | //(the resource identified by resource path) is going on, |
|
| 333 | //so control won't get into the below for loop. |
|
| 334 | //we will directly return the root node, |
|
| 335 | //which is 'ExpandedProjectionNode' |
|
| 336 | // for resource identified by resource path. |
|
| 337 | if ($depth != 0) { |
|
| 338 | for ($i = 1; $i < $depth; $i++) { |
|
| 339 | $expandedProjectionNode |
|
| 340 | = $expandedProjectionNode->findNode($this->_segmentNames[$i]); |
|
| 341 | $this->assert( |
|
| 342 | !is_null($expandedProjectionNode), |
|
| 343 | '!is_null($expandedProjectionNode)' |
|
| 344 | ); |
|
| 345 | $this->assert( |
|
| 346 | $expandedProjectionNode instanceof ExpandedProjectionNode, |
|
| 347 | '$expandedProjectionNode instanceof ExpandedProjectionNode' |
|
| 348 | ); |
|
| 349 | } |
|
| 350 | } |
|
| 351 | } |
|
| 352 | ||
| 353 | return $expandedProjectionNode; |
|
| 354 | } |
|
| 355 | ||
| 356 | /** |
|
| 357 | * Check whether to expand a navigation property or not. |
|
| @@ 731-754 (lines=24) @@ | ||
| 728 | * |
|
| 729 | * @return ExpandedProjectionNode|null |
|
| 730 | */ |
|
| 731 | private function _getCurrentExpandedProjectionNode() |
|
| 732 | { |
|
| 733 | $expandedProjectionNode |
|
| 734 | = $this->request->getRootProjectionNode(); |
|
| 735 | if (!is_null($expandedProjectionNode)) { |
|
| 736 | $depth = count($this->_segmentNames); |
|
| 737 | if ($depth != 0) { |
|
| 738 | for ($i = 1; $i < $depth; $i++) { |
|
| 739 | $expandedProjectionNode |
|
| 740 | = $expandedProjectionNode->findNode($this->_segmentNames[$i]); |
|
| 741 | $this->assert( |
|
| 742 | !is_null($expandedProjectionNode), |
|
| 743 | '!is_null($expandedProjectionNode)' |
|
| 744 | ); |
|
| 745 | $this->assert( |
|
| 746 | $expandedProjectionNode instanceof ExpandedProjectionNode, |
|
| 747 | '$expandedProjectionNode instanceof ExpandedProjectionNode' |
|
| 748 | ); |
|
| 749 | } |
|
| 750 | } |
|
| 751 | } |
|
| 752 | ||
| 753 | return $expandedProjectionNode; |
|
| 754 | } |
|
| 755 | ||
| 756 | /** |
|
| 757 | * Pushes information about the segment whose instance is going to be |
|