@@ -38,11 +38,9 @@ |
||
| 38 | 38 | * (if any) and orderby path |
| 39 | 39 | * if IDSQP implementation wants to perform sorting. |
| 40 | 40 | * |
| 41 | - * @param AnonymousFunction[] $subSorterFunctions Collection of sub sorter functions corresponding to each orderby path segment |
|
| 42 | 41 | * |
| 43 | 42 | * |
| 44 | 43 | * |
| 45 | - * @param AnonymousFunction $sorterFunction The top level anonymous sorter function. |
|
| 46 | 44 | * |
| 47 | 45 | * @param mixed $dummyObject A dummy object of type |
| 48 | 46 | * of the resource set |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | * Determines if the given writer is capable of writing the response or not |
| 37 | 37 | * @param Version $responseVersion the OData version of the response |
| 38 | 38 | * @param string $contentType the Content Type of the response |
| 39 | - * @return boolean true if the writer can handle the response, false otherwise |
|
| 39 | + * @return boolean|null true if the writer can handle the response, false otherwise |
|
| 40 | 40 | */ |
| 41 | 41 | public function canHandle(Version $responseVersion, $contentType) |
| 42 | 42 | { |
@@ -18,39 +18,39 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class JsonODataV2Writer extends JsonODataV1Writer |
| 20 | 20 | { |
| 21 | - //The key difference between 1 and 2 is that in 2 collection results |
|
| 22 | - //are wrapped in a "result" array. this is to allow a place for collection metadata to be placed |
|
| 23 | - // |
|
| 24 | - //IE {d : [ item1, item2, item3] } |
|
| 25 | - //is now { d : { results :[item1, item2, item3], meta1 : x, meta2 : y } |
|
| 26 | - //So we override the collection methods to shove this stuff in there |
|
| 27 | - |
|
| 28 | - protected $dataArrayName = ODataConstants::JSON_RESULT_NAME; |
|
| 29 | - |
|
| 30 | - protected $rowCountName = ODataConstants::JSON_ROWCOUNT_STRING; |
|
| 31 | - |
|
| 32 | - protected $nextLinkName = ODataConstants::JSON_NEXT_STRING; |
|
| 33 | - |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * Determines if the given writer is capable of writing the response or not |
|
| 37 | - * @param Version $responseVersion the OData version of the response |
|
| 38 | - * @param string $contentType the Content Type of the response |
|
| 39 | - * @return boolean true if the writer can handle the response, false otherwise |
|
| 40 | - */ |
|
| 41 | - public function canHandle(Version $responseVersion, $contentType) |
|
| 42 | - { |
|
| 43 | - $parts = explode(";", $contentType); |
|
| 44 | - |
|
| 45 | - //special case, in v3 verbose is the v2 writer |
|
| 46 | - if($responseVersion == Version::v3()){ |
|
| 47 | - return in_array(MimeTypes::MIME_APPLICATION_JSON, $parts) && (in_array('odata=verbose', $parts) || in_array('odata=minimal', $parts)); |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - if($responseVersion != Version::v2()){ |
|
| 51 | - return false; |
|
| 52 | - } |
|
| 53 | - } |
|
| 21 | + //The key difference between 1 and 2 is that in 2 collection results |
|
| 22 | + //are wrapped in a "result" array. this is to allow a place for collection metadata to be placed |
|
| 23 | + // |
|
| 24 | + //IE {d : [ item1, item2, item3] } |
|
| 25 | + //is now { d : { results :[item1, item2, item3], meta1 : x, meta2 : y } |
|
| 26 | + //So we override the collection methods to shove this stuff in there |
|
| 27 | + |
|
| 28 | + protected $dataArrayName = ODataConstants::JSON_RESULT_NAME; |
|
| 29 | + |
|
| 30 | + protected $rowCountName = ODataConstants::JSON_ROWCOUNT_STRING; |
|
| 31 | + |
|
| 32 | + protected $nextLinkName = ODataConstants::JSON_NEXT_STRING; |
|
| 33 | + |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * Determines if the given writer is capable of writing the response or not |
|
| 37 | + * @param Version $responseVersion the OData version of the response |
|
| 38 | + * @param string $contentType the Content Type of the response |
|
| 39 | + * @return boolean true if the writer can handle the response, false otherwise |
|
| 40 | + */ |
|
| 41 | + public function canHandle(Version $responseVersion, $contentType) |
|
| 42 | + { |
|
| 43 | + $parts = explode(";", $contentType); |
|
| 44 | + |
|
| 45 | + //special case, in v3 verbose is the v2 writer |
|
| 46 | + if($responseVersion == Version::v3()){ |
|
| 47 | + return in_array(MimeTypes::MIME_APPLICATION_JSON, $parts) && (in_array('odata=verbose', $parts) || in_array('odata=minimal', $parts)); |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + if($responseVersion != Version::v2()){ |
|
| 51 | + return false; |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -43,11 +43,11 @@ |
||
| 43 | 43 | $parts = explode(";", $contentType); |
| 44 | 44 | |
| 45 | 45 | //special case, in v3 verbose is the v2 writer |
| 46 | - if($responseVersion == Version::v3()){ |
|
| 46 | + if ($responseVersion == Version::v3()) { |
|
| 47 | 47 | return in_array(MimeTypes::MIME_APPLICATION_JSON, $parts) && (in_array('odata=verbose', $parts) || in_array('odata=minimal', $parts)); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - if($responseVersion != Version::v2()){ |
|
| 50 | + if ($responseVersion != Version::v2()) { |
|
| 51 | 51 | return false; |
| 52 | 52 | } |
| 53 | 53 | } |
@@ -690,37 +690,37 @@ |
||
| 690 | 690 | |
| 691 | 691 | $null = new NullType(); |
| 692 | 692 | if ($left->typeIs($null) || $right->typeIs($null)) { |
| 693 | - // If the end user is responsible for implementing IExpressionProvider |
|
| 694 | - // then the sub-tree for a nullability check would be: |
|
| 695 | - // |
|
| 696 | - // RelationalExpression(EQ/NE) |
|
| 697 | - // | |
|
| 698 | - // ------------ |
|
| 699 | - // | | |
|
| 700 | - // | | |
|
| 701 | - // CustomerID NULL |
|
| 702 | - // |
|
| 703 | - // Otherwise (In case of default PHPExpressionProvider): |
|
| 704 | - // |
|
| 705 | - // CustomerID eq null |
|
| 706 | - // ================== |
|
| 707 | - // |
|
| 708 | - // FunctionCallExpression(is_null) |
|
| 709 | - // | |
|
| 710 | - // |- Signature => bool (typeof(CustomerID)) |
|
| 711 | - // |- args => {CustomerID} |
|
| 712 | - // |
|
| 713 | - // |
|
| 714 | - // CustomerID ne null |
|
| 715 | - // ================== |
|
| 716 | - // |
|
| 717 | - // UnaryExpression (not) |
|
| 718 | - // | |
|
| 719 | - // FunctionCallExpression(is_null) |
|
| 720 | - // | |
|
| 721 | - // |- Signature => bool (typeof(CustomerID)) |
|
| 722 | - // |- args => {CustomerID} |
|
| 723 | - // |
|
| 693 | + // If the end user is responsible for implementing IExpressionProvider |
|
| 694 | + // then the sub-tree for a nullability check would be: |
|
| 695 | + // |
|
| 696 | + // RelationalExpression(EQ/NE) |
|
| 697 | + // | |
|
| 698 | + // ------------ |
|
| 699 | + // | | |
|
| 700 | + // | | |
|
| 701 | + // CustomerID NULL |
|
| 702 | + // |
|
| 703 | + // Otherwise (In case of default PHPExpressionProvider): |
|
| 704 | + // |
|
| 705 | + // CustomerID eq null |
|
| 706 | + // ================== |
|
| 707 | + // |
|
| 708 | + // FunctionCallExpression(is_null) |
|
| 709 | + // | |
|
| 710 | + // |- Signature => bool (typeof(CustomerID)) |
|
| 711 | + // |- args => {CustomerID} |
|
| 712 | + // |
|
| 713 | + // |
|
| 714 | + // CustomerID ne null |
|
| 715 | + // ================== |
|
| 716 | + // |
|
| 717 | + // UnaryExpression (not) |
|
| 718 | + // | |
|
| 719 | + // FunctionCallExpression(is_null) |
|
| 720 | + // | |
|
| 721 | + // |- Signature => bool (typeof(CustomerID)) |
|
| 722 | + // |- args => {CustomerID} |
|
| 723 | + // |
|
| 724 | 724 | if ($isPHPExpressionProvider) { |
| 725 | 725 | $arg = $left->typeIs($null) ? $right : $left; |
| 726 | 726 | $isNullFunctionDescription = new FunctionDescription('is_null', new Boolean(), array($arg->getType())); |