29 | | This is the most important part of the RFC. It describes the problem domain in detail. Focusing on this will allow reviewers to fully understand why the proposed change is being made, and potentially suggest different/better ways of accomplishing the desired results. The more time we spend on understanding the problem, the better our solution will be. |
| 29 | Here is a simplified pattern that occurs frequently in !MapGuide applications: |
| 30 | |
| 31 | {{{ |
| 32 | $resourceService = $site->CreateService(MgServiceType::ResourceService); |
| 33 | $featureService = $site->CreateService(MgServiceType::FeatureService); |
| 34 | |
| 35 | $map = new MgMap(); |
| 36 | $map->Open($resourceService, $_POST['MAPNAME']); |
| 37 | $layer = $map->GetLayers()->GetItem($_POST['LAYERNAME']); |
| 38 | |
| 39 | $resId = new MgResourceIdentifier($layer->GetFeatureSourceId()); |
| 40 | $featureClass = $layer->GetFeatureClassName(); |
| 41 | |
| 42 | $featureService = $this->site->CreateService(MgServiceType::FeatureService); |
| 43 | |
| 44 | $reader = $featureService->SelectFeatures($resId, $featureClass, null); |
| 45 | }}} |
| 46 | |
| 47 | With the API enhancements recommended by this RFC, a more convenient and compact form might be written like this: |
| 48 | |
| 49 | {{{ |
| 50 | |
| 51 | $map = new MgMap($site); |
| 52 | $map->Open($_POST['MAPNAME']); |
| 53 | $layer = $map->GetLayers()->GetItem($_POST['LAYERNAME']); |
| 54 | |
| 55 | $reader = $layer->SelectFeatures(null); |
| 56 | }}} |
| 57 | |