@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | /** |
| 278 | 278 | * To set custom state object for this type |
| 279 | 279 | * |
| 280 | - * @param Object $object The custom object. |
|
| 280 | + * @param ResourceSet $object The custom object. |
|
| 281 | 281 | * |
| 282 | 282 | * @return void |
| 283 | 283 | */ |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | * |
| 700 | 700 | * @param array &$arrayToDetectLoopInComplexType array for detecting loop. |
| 701 | 701 | * |
| 702 | - * @return boolean true if resource type instance has bag property else false |
|
| 702 | + * @return boolean|null true if resource type instance has bag property else false |
|
| 703 | 703 | */ |
| 704 | 704 | public function hasBagProperty(&$arrayToDetectLoopInComplexType) |
| 705 | 705 | { |
@@ -829,102 +829,102 @@ |
||
| 829 | 829 | public static function getPrimitiveResourceType($typeCode) |
| 830 | 830 | { |
| 831 | 831 | switch($typeCode) { |
| 832 | - case EdmPrimitiveType::BINARY: |
|
| 833 | - return new ResourceType( |
|
| 834 | - new Binary(), ResourceTypeKind::PRIMITIVE, |
|
| 835 | - 'Binary', 'Edm' |
|
| 836 | - ); |
|
| 837 | - break; |
|
| 838 | - case EdmPrimitiveType::BOOLEAN: |
|
| 839 | - return new ResourceType( |
|
| 840 | - new Boolean(), |
|
| 841 | - ResourceTypeKind::PRIMITIVE, |
|
| 842 | - 'Boolean', 'Edm' |
|
| 843 | - ); |
|
| 844 | - break; |
|
| 845 | - case EdmPrimitiveType::BYTE: |
|
| 846 | - return new ResourceType( |
|
| 847 | - new Byte(), |
|
| 848 | - ResourceTypeKind::PRIMITIVE, |
|
| 849 | - 'Byte', 'Edm' |
|
| 850 | - ); |
|
| 851 | - break; |
|
| 852 | - case EdmPrimitiveType::DATETIME: |
|
| 853 | - return new ResourceType( |
|
| 854 | - new DateTime(), |
|
| 855 | - ResourceTypeKind::PRIMITIVE, |
|
| 856 | - 'DateTime', 'Edm' |
|
| 857 | - ); |
|
| 858 | - break; |
|
| 859 | - case EdmPrimitiveType::DECIMAL: |
|
| 860 | - return new ResourceType( |
|
| 861 | - new Decimal(), |
|
| 862 | - ResourceTypeKind::PRIMITIVE, |
|
| 863 | - 'Decimal', 'Edm' |
|
| 864 | - ); |
|
| 865 | - break; |
|
| 866 | - case EdmPrimitiveType::DOUBLE: |
|
| 867 | - return new ResourceType( |
|
| 868 | - new Double(), |
|
| 869 | - ResourceTypeKind::PRIMITIVE, |
|
| 870 | - 'Double', 'Edm' |
|
| 871 | - ); |
|
| 872 | - break; |
|
| 873 | - case EdmPrimitiveType::GUID: |
|
| 874 | - return new ResourceType( |
|
| 875 | - new Guid(), |
|
| 876 | - ResourceTypeKind::PRIMITIVE, |
|
| 877 | - 'Guid', 'Edm' |
|
| 878 | - ); |
|
| 879 | - break; |
|
| 880 | - case EdmPrimitiveType::INT16: |
|
| 881 | - return new ResourceType( |
|
| 882 | - new Int16(), |
|
| 883 | - ResourceTypeKind::PRIMITIVE, |
|
| 884 | - 'Int16', 'Edm' |
|
| 885 | - ); |
|
| 886 | - break; |
|
| 887 | - case EdmPrimitiveType::INT32: |
|
| 888 | - return new ResourceType( |
|
| 889 | - new Int32(), |
|
| 890 | - ResourceTypeKind::PRIMITIVE, |
|
| 891 | - 'Int32', 'Edm' |
|
| 892 | - ); |
|
| 893 | - break; |
|
| 894 | - case EdmPrimitiveType::INT64: |
|
| 895 | - return new ResourceType( |
|
| 896 | - new Int64(), |
|
| 897 | - ResourceTypeKind::PRIMITIVE, |
|
| 898 | - 'Int64', 'Edm' |
|
| 899 | - ); |
|
| 900 | - break; |
|
| 901 | - case EdmPrimitiveType::SBYTE: |
|
| 902 | - return new ResourceType( |
|
| 903 | - new SByte(), |
|
| 904 | - ResourceTypeKind::PRIMITIVE, |
|
| 905 | - 'SByte', 'Edm' |
|
| 906 | - ); |
|
| 907 | - break; |
|
| 908 | - case EdmPrimitiveType::SINGLE: |
|
| 909 | - return new ResourceType( |
|
| 910 | - new Single(), |
|
| 911 | - ResourceTypeKind::PRIMITIVE, |
|
| 912 | - 'Single', 'Edm' |
|
| 913 | - ); |
|
| 914 | - break; |
|
| 915 | - case EdmPrimitiveType::STRING: |
|
| 916 | - return new ResourceType( |
|
| 917 | - new StringType(), |
|
| 918 | - ResourceTypeKind::PRIMITIVE, |
|
| 919 | - 'String', 'Edm' |
|
| 920 | - ); |
|
| 921 | - break; |
|
| 922 | - default: |
|
| 923 | - throw new InvalidArgumentException( |
|
| 924 | - Messages::commonNotValidPrimitiveEDMType( |
|
| 925 | - '$typeCode', 'getPrimitiveResourceType' |
|
| 926 | - ) |
|
| 927 | - ); |
|
| 832 | + case EdmPrimitiveType::BINARY: |
|
| 833 | + return new ResourceType( |
|
| 834 | + new Binary(), ResourceTypeKind::PRIMITIVE, |
|
| 835 | + 'Binary', 'Edm' |
|
| 836 | + ); |
|
| 837 | + break; |
|
| 838 | + case EdmPrimitiveType::BOOLEAN: |
|
| 839 | + return new ResourceType( |
|
| 840 | + new Boolean(), |
|
| 841 | + ResourceTypeKind::PRIMITIVE, |
|
| 842 | + 'Boolean', 'Edm' |
|
| 843 | + ); |
|
| 844 | + break; |
|
| 845 | + case EdmPrimitiveType::BYTE: |
|
| 846 | + return new ResourceType( |
|
| 847 | + new Byte(), |
|
| 848 | + ResourceTypeKind::PRIMITIVE, |
|
| 849 | + 'Byte', 'Edm' |
|
| 850 | + ); |
|
| 851 | + break; |
|
| 852 | + case EdmPrimitiveType::DATETIME: |
|
| 853 | + return new ResourceType( |
|
| 854 | + new DateTime(), |
|
| 855 | + ResourceTypeKind::PRIMITIVE, |
|
| 856 | + 'DateTime', 'Edm' |
|
| 857 | + ); |
|
| 858 | + break; |
|
| 859 | + case EdmPrimitiveType::DECIMAL: |
|
| 860 | + return new ResourceType( |
|
| 861 | + new Decimal(), |
|
| 862 | + ResourceTypeKind::PRIMITIVE, |
|
| 863 | + 'Decimal', 'Edm' |
|
| 864 | + ); |
|
| 865 | + break; |
|
| 866 | + case EdmPrimitiveType::DOUBLE: |
|
| 867 | + return new ResourceType( |
|
| 868 | + new Double(), |
|
| 869 | + ResourceTypeKind::PRIMITIVE, |
|
| 870 | + 'Double', 'Edm' |
|
| 871 | + ); |
|
| 872 | + break; |
|
| 873 | + case EdmPrimitiveType::GUID: |
|
| 874 | + return new ResourceType( |
|
| 875 | + new Guid(), |
|
| 876 | + ResourceTypeKind::PRIMITIVE, |
|
| 877 | + 'Guid', 'Edm' |
|
| 878 | + ); |
|
| 879 | + break; |
|
| 880 | + case EdmPrimitiveType::INT16: |
|
| 881 | + return new ResourceType( |
|
| 882 | + new Int16(), |
|
| 883 | + ResourceTypeKind::PRIMITIVE, |
|
| 884 | + 'Int16', 'Edm' |
|
| 885 | + ); |
|
| 886 | + break; |
|
| 887 | + case EdmPrimitiveType::INT32: |
|
| 888 | + return new ResourceType( |
|
| 889 | + new Int32(), |
|
| 890 | + ResourceTypeKind::PRIMITIVE, |
|
| 891 | + 'Int32', 'Edm' |
|
| 892 | + ); |
|
| 893 | + break; |
|
| 894 | + case EdmPrimitiveType::INT64: |
|
| 895 | + return new ResourceType( |
|
| 896 | + new Int64(), |
|
| 897 | + ResourceTypeKind::PRIMITIVE, |
|
| 898 | + 'Int64', 'Edm' |
|
| 899 | + ); |
|
| 900 | + break; |
|
| 901 | + case EdmPrimitiveType::SBYTE: |
|
| 902 | + return new ResourceType( |
|
| 903 | + new SByte(), |
|
| 904 | + ResourceTypeKind::PRIMITIVE, |
|
| 905 | + 'SByte', 'Edm' |
|
| 906 | + ); |
|
| 907 | + break; |
|
| 908 | + case EdmPrimitiveType::SINGLE: |
|
| 909 | + return new ResourceType( |
|
| 910 | + new Single(), |
|
| 911 | + ResourceTypeKind::PRIMITIVE, |
|
| 912 | + 'Single', 'Edm' |
|
| 913 | + ); |
|
| 914 | + break; |
|
| 915 | + case EdmPrimitiveType::STRING: |
|
| 916 | + return new ResourceType( |
|
| 917 | + new StringType(), |
|
| 918 | + ResourceTypeKind::PRIMITIVE, |
|
| 919 | + 'String', 'Edm' |
|
| 920 | + ); |
|
| 921 | + break; |
|
| 922 | + default: |
|
| 923 | + throw new InvalidArgumentException( |
|
| 924 | + Messages::commonNotValidPrimitiveEDMType( |
|
| 925 | + '$typeCode', 'getPrimitiveResourceType' |
|
| 926 | + ) |
|
| 927 | + ); |
|
| 928 | 928 | } |
| 929 | 929 | } |
| 930 | 930 | |
@@ -828,7 +828,7 @@ discard block |
||
| 828 | 828 | */ |
| 829 | 829 | public static function getPrimitiveResourceType($typeCode) |
| 830 | 830 | { |
| 831 | - switch($typeCode) { |
|
| 831 | + switch ($typeCode) { |
|
| 832 | 832 | case EdmPrimitiveType::BINARY: |
| 833 | 833 | return new ResourceType( |
| 834 | 834 | new Binary(), ResourceTypeKind::PRIMITIVE, |
@@ -929,7 +929,7 @@ discard block |
||
| 929 | 929 | } |
| 930 | 930 | |
| 931 | 931 | |
| 932 | - function __wakeup () { |
|
| 932 | + function __wakeup() { |
|
| 933 | 933 | if ($this->_type instanceof ReflectionClass) $this->_type = new ReflectionClass($this->_type->name); |
| 934 | 934 | } |
| 935 | 935 | } |
@@ -930,6 +930,8 @@ |
||
| 930 | 930 | |
| 931 | 931 | |
| 932 | 932 | function __wakeup () { |
| 933 | - if ($this->_type instanceof ReflectionClass) $this->_type = new ReflectionClass($this->_type->name); |
|
| 933 | + if ($this->_type instanceof ReflectionClass) { |
|
| 934 | + $this->_type = new ReflectionClass($this->_type->name); |
|
| 935 | + } |
|
| 934 | 936 | } |
| 935 | 937 | } |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | if (!is_null($resourceProperty) |
| 59 | - && (is_null($resourceType->resolveProperty($resourceProperty->getName())) || (($resourceProperty->getKind() != ResourcePropertyKind::RESOURCE_REFERENCE) && ($resourceProperty->getKind() != ResourcePropertyKind::RESOURCESET_REFERENCE)&& ($resourceProperty->getKind() != ResourcePropertyKind::KEY_RESOURCE_REFERENCE))) |
|
| 59 | + && (is_null($resourceType->resolveProperty($resourceProperty->getName())) || (($resourceProperty->getKind() != ResourcePropertyKind::RESOURCE_REFERENCE) && ($resourceProperty->getKind() != ResourcePropertyKind::RESOURCESET_REFERENCE) && ($resourceProperty->getKind() != ResourcePropertyKind::KEY_RESOURCE_REFERENCE))) |
|
| 60 | 60 | ) { |
| 61 | 61 | throw new \InvalidArgumentException( |
| 62 | 62 | Messages::resourceAssociationSetEndPropertyMustBeNavigationProperty( |
@@ -172,7 +172,7 @@ |
||
| 172 | 172 | private function _isValidResourcePropertyKind($kind) |
| 173 | 173 | { |
| 174 | 174 | return |
| 175 | - !($kind != ResourcePropertyKind::RESOURCE_REFERENCE && |
|
| 175 | + !($kind != ResourcePropertyKind::RESOURCE_REFERENCE && |
|
| 176 | 176 | $kind != ResourcePropertyKind::KEY_RESOURCE_REFERENCE && |
| 177 | 177 | $kind != ResourcePropertyKind::RESOURCESET_REFERENCE && |
| 178 | 178 | $kind != ResourcePropertyKind::COMPLEX_TYPE && |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * @throws ODataException If any error occur while parsing orderby clause |
| 107 | 107 | */ |
| 108 | 108 | public static function parseOrderByClause( |
| 109 | - ResourceSetWrapper $resourceSetWrapper, |
|
| 109 | + ResourceSetWrapper $resourceSetWrapper, |
|
| 110 | 110 | ResourceType $resourceType, |
| 111 | 111 | $orderBy, |
| 112 | 112 | ProvidersWrapper $providerWrapper |
@@ -190,14 +190,14 @@ discard block |
||
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | if ($resourceProperty->isKindOf(ResourcePropertyKind::BAG)) { |
| 193 | - throw ODataException::createBadRequestError( |
|
| 193 | + throw ODataException::createBadRequestError( |
|
| 194 | 194 | Messages::orderByParserBagPropertyNotAllowed( |
| 195 | 195 | $resourceProperty->getName() |
| 196 | 196 | ) |
| 197 | 197 | ); |
| 198 | 198 | } else if ($resourceProperty->isKindOf(ResourcePropertyKind::PRIMITIVE)) { |
| 199 | 199 | if (!$isLastSegment) { |
| 200 | - throw ODataException::createBadRequestError( |
|
| 200 | + throw ODataException::createBadRequestError( |
|
| 201 | 201 | Messages::orderByParserPrimitiveAsIntermediateSegment( |
| 202 | 202 | $resourceProperty->getName() |
| 203 | 203 | ) |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | $type = $resourceProperty->getInstanceType(); |
| 208 | 208 | if ($type instanceof Binary) { |
| 209 | - throw ODataException::createBadRequestError(Messages::orderByParserSortByBinaryPropertyNotAllowed($resourceProperty->getName())); |
|
| 209 | + throw ODataException::createBadRequestError(Messages::orderByParserSortByBinaryPropertyNotAllowed($resourceProperty->getName())); |
|
| 210 | 210 | } |
| 211 | 211 | } else if ($resourceProperty->getKind() == ResourcePropertyKind::RESOURCESET_REFERENCE |
| 212 | 212 | || $resourceProperty->getKind() == ResourcePropertyKind::RESOURCE_REFERENCE |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | $resourceSetWrapper, $resourceType, $resourceProperty |
| 221 | 221 | ); |
| 222 | 222 | if (is_null($resourceSetWrapper)) { |
| 223 | - throw ODataException::createBadRequestError( |
|
| 223 | + throw ODataException::createBadRequestError( |
|
| 224 | 224 | Messages::badRequestInvalidPropertyNameSpecified( |
| 225 | 225 | $resourceType->getFullName(), $orderBySubPathSegment |
| 226 | 226 | ) |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | if ($resourceProperty->getKind() == ResourcePropertyKind::RESOURCESET_REFERENCE) { |
| 231 | - throw ODataException::createBadRequestError( |
|
| 231 | + throw ODataException::createBadRequestError( |
|
| 232 | 232 | Messages::orderByParserResourceSetReferenceNotAllowed( |
| 233 | 233 | $resourceProperty->getName(), $resourceType->getFullName() |
| 234 | 234 | ) |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | $ancestors[] = $orderBySubPathSegment; |
| 250 | 250 | } else if ($resourceProperty->isKindOf(ResourcePropertyKind::COMPLEX_TYPE)) { |
| 251 | 251 | if ($isLastSegment) { |
| 252 | - throw ODataException::createBadRequestError( |
|
| 252 | + throw ODataException::createBadRequestError( |
|
| 253 | 253 | Messages::orderByParserSortByComplexPropertyIsNotAllowed( |
| 254 | 254 | $resourceProperty->getName() |
| 255 | 255 | ) |