Complex classes like ProvidersWrapper often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use ProvidersWrapper, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 34 | class ProvidersWrapper |
||
| 35 | { |
||
| 36 | /** |
||
| 37 | * Holds reference to IMetadataProvider implementation. |
||
| 38 | * |
||
| 39 | * @var IMetadataProvider |
||
| 40 | */ |
||
| 41 | private $metaProvider; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Holds reference to IServiceConfiguration implementation. |
||
| 45 | * |
||
| 46 | * @var IServiceConfiguration |
||
| 47 | */ |
||
| 48 | private $config; |
||
| 49 | |||
| 50 | /* |
||
| 51 | * Holds reference to ProvidersQueryWrapper implementation |
||
| 52 | * |
||
| 53 | * @var ProvidersQueryWrapper |
||
| 54 | */ |
||
| 55 | private $providerWrapper; |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Cache for ResourceProperties of a resource type that belongs to a |
||
| 59 | * resource set. An entry (ResourceProperty collection) in this cache |
||
| 60 | * contains only the visible properties of ResourceType. |
||
| 61 | * |
||
| 62 | * @var array<array> |
||
| 63 | */ |
||
| 64 | private $propertyCache; |
||
| 65 | |||
| 66 | /** |
||
| 67 | * Cache for ResourceSetWrappers. If ResourceSet is invisible value will |
||
| 68 | * be null. |
||
| 69 | * |
||
| 70 | * @var ResourceSetWrapper[] indexed by resource set name |
||
| 71 | */ |
||
| 72 | private $setWrapperCache; |
||
| 73 | |||
| 74 | /** |
||
| 75 | * Cache for ResourceTypes. |
||
| 76 | * |
||
| 77 | * @var ResourceType[] indexed by resource type name |
||
| 78 | */ |
||
| 79 | private $typeCache; |
||
| 80 | |||
| 81 | /** |
||
| 82 | * Cache for ResourceAssociationSet. If ResourceAssociationSet is invisible |
||
| 83 | * value will be null. |
||
| 84 | * |
||
| 85 | * @var ResourceAssociationSet[] indexed by name |
||
| 86 | */ |
||
| 87 | private $associationSetCache; |
||
|
|
|||
| 88 | |||
| 89 | /** |
||
| 90 | * Creates a new instance of ProvidersWrapper. |
||
| 91 | * |
||
| 92 | * @param IMetadataProvider $meta Reference to IMetadataProvider implementation |
||
| 93 | * @param IQueryProvider $query Reference to IQueryProvider implementation |
||
| 94 | * @param IServiceConfiguration $config Reference to IServiceConfiguration implementation |
||
| 95 | */ |
||
| 96 | public function __construct(IMetadataProvider $meta, IQueryProvider $query, IServiceConfiguration $config) |
||
| 97 | { |
||
| 98 | $this->metaProvider = $meta; |
||
| 99 | $this->config = $config; |
||
| 100 | $this->providerWrapper = new ProvidersQueryWrapper($query); |
||
| 101 | $this->setWrapperCache = []; |
||
| 102 | $this->typeCache = []; |
||
| 103 | $this->propertyCache = []; |
||
| 104 | } |
||
| 105 | |||
| 106 | public function getProviderWrapper() |
||
| 107 | { |
||
| 108 | assert(null != $this->providerWrapper, 'Provider wrapper must be set'); |
||
| 109 | return $this->providerWrapper; |
||
| 110 | } |
||
| 111 | |||
| 112 | //Wrappers for IMetadataProvider methods |
||
| 113 | |||
| 114 | /** |
||
| 115 | * To get the Container name for the data source, |
||
| 116 | * Note: Wrapper for IMetadataProvider::getContainerName method |
||
| 117 | * implementation. |
||
| 118 | * |
||
| 119 | * @throws ODataException Exception if implementation returns empty container name |
||
| 120 | * |
||
| 121 | * @return string that contains the name of the container |
||
| 122 | */ |
||
| 123 | public function getContainerName() |
||
| 135 | |||
| 136 | /** |
||
| 137 | * To get Namespace name for the data source, |
||
| 138 | * Note: Wrapper for IMetadataProvider::getContainerNamespace method implementation. |
||
| 139 | * |
||
| 140 | * @throws ODataException Exception if implementation returns empty container namespace |
||
| 141 | * |
||
| 142 | * @return string that contains the namespace name |
||
| 143 | */ |
||
| 144 | public function getContainerNamespace() |
||
| 156 | |||
| 157 | /** |
||
| 158 | * To get the data service configuration. |
||
| 159 | * |
||
| 160 | * @return IServiceConfiguration |
||
| 161 | */ |
||
| 162 | public function getConfiguration() |
||
| 166 | |||
| 167 | /** |
||
| 168 | * To get all entity set information, |
||
| 169 | * Note: Wrapper for IMetadataProvider::getResourceSets method implementation, |
||
| 170 | * This method returns array of ResourceSetWrapper instances but the corresponding IDSMP method |
||
| 171 | * returns array of ResourceSet instances. |
||
| 172 | * |
||
| 173 | * @throws ODataException when two resource sets with the same name are encountered |
||
| 174 | * |
||
| 175 | * @return ResourceSetWrapper[] The ResourceSetWrappers for the visible ResourceSets |
||
| 176 | */ |
||
| 177 | public function getResourceSets() |
||
| 197 | |||
| 198 | /** |
||
| 199 | * This function perform the following operations |
||
| 200 | * (1) If the cache contain an entry [key, value] for the resourceset then |
||
| 201 | * return the entry-value |
||
| 202 | * (2) If the cache not contain an entry for the resourceset then validate |
||
| 203 | * the resourceset |
||
| 204 | * (a) If valid add entry as [resouceset_name, resourceSetWrapper] |
||
| 205 | * (b) if not valid add entry as [resouceset_name, null] |
||
| 206 | * Note: validating a resourceset means checking the resourceset is visible |
||
| 207 | * or not using configuration. |
||
| 208 | * |
||
| 209 | * @param ResourceSet $resourceSet The resourceset to validate and get the |
||
| 210 | * wrapper for |
||
| 211 | * |
||
| 212 | * @return ResourceSetWrapper|null Returns an instance if a resource set with the given name is visible |
||
| 213 | */ |
||
| 214 | private function validateResourceSetAndWrapper(ResourceSet $resourceSet) |
||
| 215 | { |
||
| 216 | $cacheKey = $resourceSet->getName(); |
||
| 217 | if (array_key_exists($cacheKey, $this->setWrapperCache)) { |
||
| 218 | return $this->setWrapperCache[$cacheKey]; |
||
| 219 | } |
||
| 220 | |||
| 221 | $this->validateResourceType($resourceSet->getResourceType()); |
||
| 222 | $wrapper = new ResourceSetWrapper($resourceSet, $this->config); |
||
| 223 | $nuVal = $wrapper->isVisible() ? $wrapper : null; |
||
| 224 | $this->setWrapperCache[$cacheKey] = $nuVal; |
||
| 225 | |||
| 226 | return $this->setWrapperCache[$cacheKey]; |
||
| 227 | } |
||
| 228 | |||
| 229 | /** |
||
| 230 | * Validates the given instance of ResourceType. |
||
| 231 | * |
||
| 232 | * @param ResourceType $resourceType The ResourceType to validate |
||
| 233 | * |
||
| 234 | * @throws ODataException Exception if $resourceType is invalid |
||
| 235 | * |
||
| 236 | * @return ResourceType |
||
| 237 | */ |
||
| 238 | private function validateResourceType(ResourceType $resourceType) |
||
| 250 | |||
| 251 | /** |
||
| 252 | * To get all resource types in the data source, |
||
| 253 | * Note: Wrapper for IMetadataProvider::getTypes method implementation. |
||
| 254 | * |
||
| 255 | * @throws ODataException |
||
| 256 | * @return ResourceType[] |
||
| 257 | */ |
||
| 258 | public function getTypes() |
||
| 259 | { |
||
| 260 | $resourceTypes = $this->metaProvider->getTypes(); |
||
| 261 | $resourceTypeNames = []; |
||
| 262 | foreach ($resourceTypes as $resourceType) { |
||
| 263 | if (in_array($resourceType->getName(), $resourceTypeNames)) { |
||
| 264 | throw new ODataException( |
||
| 265 | Messages::providersWrapperEntityTypeNameShouldBeUnique($resourceType->getName()), |
||
| 266 | 500 |
||
| 267 | ); |
||
| 268 | } |
||
| 269 | |||
| 270 | $resourceTypeNames[] = $resourceType->getName(); |
||
| 271 | $this->validateResourceType($resourceType); |
||
| 272 | } |
||
| 273 | |||
| 274 | return $resourceTypes; |
||
| 275 | } |
||
| 276 | |||
| 277 | public function getSingletons() |
||
| 278 | { |
||
| 279 | $singletons = $this->metaProvider->getSingletons(); |
||
| 280 | return (null == $singletons) ? [] : $singletons; |
||
| 281 | } |
||
| 282 | |||
| 283 | /** |
||
| 284 | * To get a resource set based on the specified resource set name which is |
||
| 285 | * visible, |
||
| 286 | * Note: Wrapper for IMetadataProvider::resolveResourceSet method |
||
| 287 | * implementation. |
||
| 288 | * |
||
| 289 | * @param string $name Name of the resource set |
||
| 290 | * |
||
| 291 | * @return ResourceSetWrapper|null Returns resource set with the given name if found, |
||
| 292 | * NULL if resource set is set to invisible or not found |
||
| 293 | */ |
||
| 294 | public function resolveResourceSet($name) |
||
| 295 | { |
||
| 296 | if (array_key_exists($name, $this->setWrapperCache)) { |
||
| 297 | return $this->setWrapperCache[$name]; |
||
| 298 | } |
||
| 299 | |||
| 300 | $resourceSet = $this->metaProvider->resolveResourceSet($name); |
||
| 301 | if (null === $resourceSet) { |
||
| 302 | return null; |
||
| 303 | } |
||
| 304 | |||
| 305 | return $this->validateResourceSetAndWrapper($resourceSet); |
||
| 306 | } |
||
| 307 | |||
| 308 | /** |
||
| 309 | * To get a resource type based on the resource set name, |
||
| 310 | * Note: Wrapper for IMetadataProvider::resolveResourceType |
||
| 311 | * method implementation. |
||
| 312 | * |
||
| 313 | * @param string $name Name of the resource set |
||
| 314 | * |
||
| 315 | * @throws ODataException If the ResourceType is invalid |
||
| 316 | * |
||
| 317 | * @return ResourceType|null resource type with the given resource set name if found else NULL |
||
| 318 | */ |
||
| 319 | public function resolveResourceType($name) |
||
| 320 | { |
||
| 321 | $resourceType = $this->metaProvider->resolveResourceType($name); |
||
| 322 | if (null === $resourceType) { |
||
| 323 | return null; |
||
| 324 | } |
||
| 325 | |||
| 326 | return $this->validateResourceType($resourceType); |
||
| 327 | } |
||
| 328 | |||
| 329 | /** |
||
| 330 | * Try to resolve named singleton |
||
| 331 | * |
||
| 332 | * @param string $name |
||
| 333 | * @return mixed|null |
||
| 334 | */ |
||
| 335 | public function resolveSingleton($name) |
||
| 336 | { |
||
| 337 | $singletons = $this->metaProvider->getSingletons(); |
||
| 338 | if (array_key_exists($name, $singletons)) { |
||
| 339 | return $singletons[$name]; |
||
| 340 | } |
||
| 341 | return null; |
||
| 342 | } |
||
| 343 | |||
| 344 | /** |
||
| 345 | * The method must return a collection of all the types derived from |
||
| 346 | * $resourceType The collection returned should NOT include the type |
||
| 347 | * passed in as a parameter |
||
| 348 | * Note: Wrapper for IMetadataProvider::getDerivedTypes |
||
| 349 | * method implementation. |
||
| 350 | * |
||
| 351 | * @param ResourceEntityType $resourceType Resource to get derived resource types from |
||
| 352 | * |
||
| 353 | * @throws InvalidOperationException when the meat provider doesn't return an array |
||
| 354 | * |
||
| 355 | * @return ResourceType[] |
||
| 356 | */ |
||
| 357 | public function getDerivedTypes(ResourceEntityType $resourceType) |
||
| 358 | { |
||
| 359 | $derivedTypes = $this->metaProvider->getDerivedTypes($resourceType); |
||
| 360 | if (!is_array($derivedTypes)) { |
||
| 361 | throw new InvalidOperationException( |
||
| 362 | Messages::metadataAssociationTypeSetInvalidGetDerivedTypesReturnType($resourceType->getName()) |
||
| 363 | ); |
||
| 364 | } |
||
| 365 | |||
| 366 | foreach ($derivedTypes as $derivedType) { |
||
| 367 | $this->validateResourceType($derivedType); |
||
| 368 | } |
||
| 369 | |||
| 370 | return $derivedTypes; |
||
| 371 | } |
||
| 372 | |||
| 373 | /** |
||
| 374 | * Returns true if $resourceType represents an Entity Type which has derived |
||
| 375 | * Entity Types, else false. |
||
| 376 | * Note: Wrapper for IMetadataProvider::hasDerivedTypes method implementation. |
||
| 377 | * |
||
| 378 | * @param ResourceEntityType $resourceType Resource to check for derived resource types |
||
| 379 | * |
||
| 380 | * @throws ODataException If the ResourceType is invalid |
||
| 381 | * |
||
| 382 | * @return bool |
||
| 383 | */ |
||
| 384 | public function hasDerivedTypes(ResourceEntityType $resourceType) |
||
| 385 | { |
||
| 386 | $this->validateResourceType($resourceType); |
||
| 387 | |||
| 388 | return $this->metaProvider->hasDerivedTypes($resourceType); |
||
| 389 | } |
||
| 390 | |||
| 391 | /** |
||
| 392 | * Gets the visible resource properties for the given resource type from the given resource set wrapper. |
||
| 393 | * |
||
| 394 | * @param ResourceSetWrapper $setWrapper Resource set wrapper in question |
||
| 395 | * @param ResourceType $resourceType Resource type in question |
||
| 396 | * |
||
| 397 | * @return ResourceProperty[] Collection of visible resource properties from the given resource set wrapper |
||
| 398 | * and resource type |
||
| 399 | */ |
||
| 400 | public function getResourceProperties(ResourceSetWrapper $setWrapper, ResourceType $resourceType) |
||
| 401 | { |
||
| 402 | if ($resourceType->getResourceTypeKind() != ResourceTypeKind::ENTITY()) { |
||
| 403 | //Complex resource type |
||
| 404 | return $resourceType->getAllProperties(); |
||
| 405 | } |
||
| 406 | //TODO: move this to doctrine annotations |
||
| 407 | $cacheKey = $setWrapper->getName() . '_' . $resourceType->getFullName(); |
||
| 408 | if (!array_key_exists($cacheKey, $this->propertyCache)) { |
||
| 409 | //Fill the cache |
||
| 410 | $this->propertyCache[$cacheKey] = []; |
||
| 411 | foreach ($resourceType->getAllProperties() as $resourceProperty) { |
||
| 412 | //Check whether this is a visible navigation property |
||
| 413 | //TODO: is this broken?? see #87 |
||
| 414 | if ($resourceProperty->getTypeKind() == ResourceTypeKind::ENTITY() |
||
| 415 | && $resourceType instanceof ResourceEntityType |
||
| 416 | && null !== $this->getResourceSetWrapperForNavigationProperty( |
||
| 417 | $setWrapper, |
||
| 418 | $resourceType, |
||
| 419 | $resourceProperty |
||
| 420 | ) |
||
| 421 | ) { |
||
| 422 | $this->propertyCache[$cacheKey][$resourceProperty->getName()] = $resourceProperty; |
||
| 423 | } else { |
||
| 424 | //primitive, bag or complex property |
||
| 425 | $this->propertyCache[$cacheKey][$resourceProperty->getName()] = $resourceProperty; |
||
| 426 | } |
||
| 427 | } |
||
| 428 | } |
||
| 429 | |||
| 430 | return $this->propertyCache[$cacheKey]; |
||
| 431 | } |
||
| 432 | |||
| 433 | /** |
||
| 434 | * Gets the target resource set wrapper for the given navigation property, |
||
| 435 | * source resource set wrapper and the source resource type. |
||
| 436 | * |
||
| 437 | * @param ResourceSetWrapper $resourceSetWrapper Source resource set |
||
| 438 | * @param ResourceEntityType $resourceType Source resource type |
||
| 439 | * @param ResourceProperty $navigationResourceProperty Navigation property |
||
| 440 | * |
||
| 441 | * @return ResourceSetWrapper|null Returns instance of ResourceSetWrapper |
||
| 442 | * (describes the entity set and associated configuration) for the |
||
| 443 | * given navigation property. returns NULL if resourceset for the |
||
| 444 | * navigation property is invisible or if metadata provider returns |
||
| 445 | * null resource association set |
||
| 446 | */ |
||
| 447 | public function getResourceSetWrapperForNavigationProperty( |
||
| 471 | |||
| 472 | /** |
||
| 473 | * Gets the ResourceAssociationSet instance for the given source association end, |
||
| 474 | * Note: Wrapper for IMetadataProvider::getResourceAssociationSet |
||
| 475 | * method implementation. |
||
| 476 | * |
||
| 477 | * @param ResourceSet $set Resource set of the source association end |
||
| 478 | * @param ResourceEntityType $type Resource type of the source association end |
||
| 479 | * @param ResourceProperty $property Resource property of the source association end |
||
| 480 | * |
||
| 481 | * @throws ODataException |
||
| 482 | * @return ResourceAssociationSet|null Returns ResourceAssociationSet for the source |
||
| 483 | * association end, NULL if no such |
||
| 484 | * association end or resource set in the |
||
| 485 | * other end of the association is invisible |
||
| 486 | */ |
||
| 487 | public function getResourceAssociationSet( |
||
| 488 | ResourceSet $set, |
||
| 489 | ResourceEntityType $type, |
||
| 490 | ResourceProperty $property |
||
| 491 | ) { |
||
| 492 | $type = $this->getResourceTypeWherePropertyIsDeclared($type, $property); |
||
| 493 | // usage below requires $type to not be null - so kaboom as early as possible |
||
| 494 | assert(null != $type, 'Resource type obtained from property must not be null.'); |
||
| 495 | assert($type instanceof ResourceEntityType); |
||
| 496 | |||
| 497 | $associationSet = $this->metaProvider->getResourceAssociationSet( |
||
| 498 | $set, |
||
| 499 | $type, |
||
| 500 | $property |
||
| 501 | ); |
||
| 502 | assert( |
||
| 503 | null == $associationSet || $associationSet instanceof ResourceAssociationSet, |
||
| 504 | 'Retrieved resource association must be either null or an instance of ResourceAssociationSet' |
||
| 505 | ); |
||
| 506 | |||
| 507 | if (null !== $associationSet) { |
||
| 508 | $thisAssociationSetEnd = $associationSet->getResourceAssociationSetEnd( |
||
| 509 | $set, |
||
| 510 | $type, |
||
| 511 | $property |
||
| 512 | ); |
||
| 513 | |||
| 514 | $relatedAssociationSetEnd = $associationSet->getRelatedResourceAssociationSetEnd( |
||
| 515 | $set, |
||
| 516 | $type, |
||
| 517 | $property |
||
| 518 | ); |
||
| 519 | |||
| 520 | //If either $thisAssociationSetEnd and/or $relatedAssociationSetEnd |
||
| 521 | //is null means the associationset we got from the IDSMP::getResourceAssociationSet is invalid. |
||
| 522 | |||
| 523 | //Return null, if either AssociationSet's End1 or End2's resourceset name |
||
| 524 | //doesn't match the name of resource set wrapper (param1) and resource type is not assignable |
||
| 525 | //from given resource type (param2) |
||
| 526 | if (null === $thisAssociationSetEnd || null === $relatedAssociationSetEnd) { |
||
| 527 | throw new ODataException( |
||
| 528 | Messages::providersWrapperIDSMPGetResourceSetReturnsInvalidResourceSet( |
||
| 529 | $set->getName(), |
||
| 530 | $type->getFullName(), |
||
| 531 | $property->getName() |
||
| 532 | ), |
||
| 533 | 500 |
||
| 534 | ); |
||
| 535 | } |
||
| 536 | |||
| 537 | $relatedResourceSetWrapper = $this->validateResourceSetAndWrapper( |
||
| 538 | $relatedAssociationSetEnd->getResourceSet() |
||
| 539 | ); |
||
| 540 | if ($relatedResourceSetWrapper === null) { |
||
| 541 | $associationSet = null; |
||
| 542 | } else { |
||
| 543 | $this->validateResourceType($thisAssociationSetEnd->getResourceType()); |
||
| 544 | $this->validateResourceType($relatedAssociationSetEnd->getResourceType()); |
||
| 545 | } |
||
| 546 | } |
||
| 547 | assert( |
||
| 548 | null == $associationSet || $associationSet instanceof ResourceAssociationSet, |
||
| 549 | 'Retrieved resource assocation must be either null or an instance of ResourceAssociationSet' |
||
| 550 | ); |
||
| 551 | |||
| 552 | return $associationSet; |
||
| 553 | } |
||
| 554 | |||
| 555 | /** |
||
| 556 | * Gets the resource type on which the resource property is declared on, |
||
| 557 | * If property is not declared in the given resource type, then this |
||
| 558 | * function drill down to the inheritance hierarchy of the given resource |
||
| 559 | * type to find out the base class in which the property is declared. |
||
| 560 | * |
||
| 561 | * @param ResourceType $type The resource type to start looking |
||
| 562 | * @param ResourceProperty $property The resource property in question |
||
| 563 | * |
||
| 564 | * @return ResourceType|null Returns reference to the ResourceType on which |
||
| 565 | * the $property is declared, NULL if |
||
| 566 | * $property is not declared anywhere |
||
| 567 | * in the inheritance hierarchy |
||
| 568 | */ |
||
| 569 | private function getResourceTypeWherePropertyIsDeclared(ResourceType $type, ResourceProperty $property) |
||
| 581 | |||
| 582 | /** |
||
| 583 | * Wrapper function over _validateResourceSetAndGetWrapper function. |
||
| 584 | * |
||
| 585 | * @param ResourceSet $resourceSet see the comments of _validateResourceSetAndGetWrapper |
||
| 586 | * |
||
| 587 | * @return ResourceSetWrapper|null see the comments of _validateResourceSetAndGetWrapper |
||
| 588 | */ |
||
| 589 | public function validateResourceSetAndGetWrapper(ResourceSet $resourceSet) |
||
| 593 | |||
| 594 | /** |
||
| 595 | * Gets the Edm Schema version compliance to the metadata. |
||
| 596 | * |
||
| 597 | * @return EdmSchemaVersion |
||
| 598 | */ |
||
| 599 | public function getEdmSchemaVersion() |
||
| 604 | |||
| 605 | /** |
||
| 606 | * Gets the underlying custom expression provider, the end developer is |
||
| 607 | * responsible for implementing IExpressionProvider if he choose for. |
||
| 608 | * |
||
| 609 | * @return IExpressionProvider Instance of IExpressionProvider implementation |
||
| 610 | */ |
||
| 611 | public function getExpressionProvider() |
||
| 615 | |||
| 616 | /** |
||
| 617 | * Indicates if the QueryProvider can handle ordered paging, this means respecting order, skip, and top parameters |
||
| 618 | * If the query provider can not handle ordered paging, it must return the entire result set and POData will |
||
| 619 | * perform the ordering and paging. |
||
| 620 | * |
||
| 621 | * @return bool True if the query provider can handle ordered paging, false if POData should perform the paging |
||
| 622 | */ |
||
| 623 | public function handlesOrderedPaging() |
||
| 627 | |||
| 628 | /** |
||
| 629 | * Gets collection of entities belongs to an entity set. |
||
| 630 | * |
||
| 631 | * @param QueryType $queryType Indicates if this is a query for a count, entities, or entities |
||
| 632 | * with a count |
||
| 633 | * @param ResourceSet $resourceSet The entity set containing the entities that need to be fetched |
||
| 634 | * @param FilterInfo|null $filterInfo Represents the $filter parameter of the OData query. |
||
| 635 | * NULL if no $filter specified |
||
| 636 | * @param InternalOrderByInfo|null $orderBy The orderBy information |
||
| 637 | * @param integer|null $top The top count |
||
| 638 | * @param integer|null $skip The skip count |
||
| 639 | * @param SkipTokenInfo|null $skipToken The skip token |
||
| 640 | * |
||
| 641 | * @return QueryResult |
||
| 642 | */ |
||
| 643 | public function getResourceSet( |
||
| 662 | |||
| 663 | /** |
||
| 664 | * Gets an entity instance from an entity set identified by a key. |
||
| 665 | * |
||
| 666 | * @param ResourceSet $resourceSet The entity set containing the entity to fetch |
||
| 667 | * @param KeyDescriptor $keyDescriptor The key identifying the entity to fetch |
||
| 668 | * |
||
| 669 | * @return object|null Returns entity instance if found, else null |
||
| 670 | */ |
||
| 671 | public function getResourceFromResourceSet(ResourceSet $resourceSet, KeyDescriptor $keyDescriptor) |
||
| 675 | |||
| 676 | /** |
||
| 677 | * Puts an entity instance to entity set identified by a key. |
||
| 678 | * |
||
| 679 | * @param ResourceSet $resourceSet The entity set containing the entity to update |
||
| 680 | * @param KeyDescriptor $keyDescriptor The key identifying the entity to update |
||
| 681 | * @param mixed $data |
||
| 682 | * |
||
| 683 | * @return bool|null Returns result of executing query |
||
| 684 | */ |
||
| 685 | public function putResource( |
||
| 696 | |||
| 697 | /** |
||
| 698 | * Get related resource set for a resource. |
||
| 699 | * |
||
| 700 | * @param QueryType $queryType Indicates if this is a query for a count, entities, or entities |
||
| 701 | * with a count |
||
| 702 | * @param ResourceSet $sourceResourceSet The entity set containing the source entity |
||
| 703 | * @param object $sourceEntity The source entity instance |
||
| 704 | * @param ResourceSet $targetResourceSet The resource set containing the target of the navigation property |
||
| 705 | * @param ResourceProperty $targetProperty The navigation property to retrieve |
||
| 706 | * @param FilterInfo|null $filterInfo Represents the $filter parameter of the OData query. |
||
| 707 | * NULL if no $filter specified |
||
| 708 | * @param mixed $orderBy sorted order if we want to get the data in some specific order |
||
| 709 | * @param int $top number of records which need to be retrieved |
||
| 710 | * @param int $skip number of records which need to be skipped |
||
| 711 | * @param SkipTokenInfo|null $skipToken value indicating what records to skip |
||
| 712 | * |
||
| 713 | * @throws ODataException |
||
| 714 | * |
||
| 715 | * @return QueryResult |
||
| 716 | */ |
||
| 717 | public function getRelatedResourceSet( |
||
| 742 | |||
| 743 | /** |
||
| 744 | * Gets a related entity instance from an entity set identified by a key. |
||
| 745 | * |
||
| 746 | * @param ResourceSet $sourceResourceSet The entity set related to the entity to be fetched |
||
| 747 | * @param object $sourceEntity The related entity instance |
||
| 748 | * @param ResourceSet $targetResourceSet The entity set from which entity needs to be fetched |
||
| 749 | * @param ResourceProperty $targetProperty The metadata of the target property |
||
| 750 | * @param KeyDescriptor $keyDescriptor The key to identify the entity to be fetched |
||
| 751 | * |
||
| 752 | * @return object|null Returns entity instance if found, else null |
||
| 753 | */ |
||
| 754 | public function getResourceFromRelatedResourceSet( |
||
| 769 | |||
| 770 | /** |
||
| 771 | * Get related resource for a resource. |
||
| 772 | * |
||
| 773 | * @param ResourceSet $sourceResourceSet The source resource set |
||
| 774 | * @param object $sourceEntity The source resource |
||
| 775 | * @param ResourceSet $targetResourceSet The resource set of the navigation |
||
| 776 | * property |
||
| 777 | * @param ResourceProperty $targetProperty The navigation property to be |
||
| 778 | * retrieved |
||
| 779 | * |
||
| 780 | * @return object|null The related resource if exists, else null |
||
| 781 | */ |
||
| 782 | public function getRelatedResourceReference( |
||
| 795 | |||
| 796 | /** |
||
| 797 | * Updates a resource. |
||
| 798 | * |
||
| 799 | * @param ResourceSet $sourceResourceSet The entity set containing the source entity |
||
| 800 | * @param object $sourceEntityInstance The source entity instance |
||
| 801 | * @param KeyDescriptor $keyDescriptor The key identifying the entity to fetch |
||
| 802 | * @param object $data the New data for the entity instance |
||
| 803 | * @param bool $shouldUpdate Should undefined values be updated or reset to default |
||
| 804 | * |
||
| 805 | * @return object|null the new resource value if it is assignable, or throw exception for null |
||
| 806 | */ |
||
| 807 | public function updateResource( |
||
| 822 | |||
| 823 | /** |
||
| 824 | * Delete resource from a resource set. |
||
| 825 | * |
||
| 826 | * @param ResourceSet $sourceResourceSet |
||
| 827 | * @param object $sourceEntityInstance |
||
| 828 | * |
||
| 829 | * @return bool true if resources successfully deleted, otherwise false |
||
| 830 | */ |
||
| 831 | public function deleteResource( |
||
| 840 | |||
| 841 | /** |
||
| 842 | * @param ResourceSet $resourceSet The entity set containing the entity to fetch |
||
| 843 | * @param object $sourceEntityInstance The source entity instance |
||
| 844 | * @param object $data The New data for the entity instance. |
||
| 845 | * |
||
| 846 | * @return object|null returns the newly created model if successful, or null if model creation failed. |
||
| 847 | */ |
||
| 848 | public function createResourceforResourceSet( |
||
| 859 | |||
| 860 | public function getMetadataXML() |
||
| 864 | } |
||
| 865 |
This check marks private properties in classes that are never used. Those properties can be removed.