Details
-
Type: Improvement
-
Status: Closed
-
Priority: Trivial
-
Resolution: Fixed
-
Affects Version/s: 4.0.0
-
Fix Version/s: 4.3.0-b1
-
Component/s: None
-
Labels:None
Description
minphp changed in v4.0 such that API actions no longer return the expected response for plugins since it is now case-sensitive. We can update the API controller to support this again relatively easily, however, it is recommended to use CamelCase names to reference models rather than snake_case.
Consider the following example:
```
$response = $api->get("support_manager.support_manager_departments", "getList", array('company_id' => 1));
```
Pre-4.0, the API controller would set the model to "SupportManager.supportManagerDepartments", which would successfully load the SupportManagerDepartments model from the SupportManager plugin. While the same string is converted to camel-case in the same way post-4.0, minphp does not load "SupportManager.supportManagerDepartments" because it cannot find the class due to case-sensitivity.
Sample fix in /app/controllers/api.php:
-$this->model = Loader::toCamelCase($this->get[0]); +$this->model = ''; +$fields = explode('.', $this->get[0]); +foreach ($fields as $i => $field) { + $this->model .= Loader::toCamelCase($field) . (isset($fields[$i+1]) ? '.' : ''); +}
Activity
Field | Original Value | New Value |
---|---|---|
Rank | Ranked higher |
Story Points | 3 |
Rank | Ranked higher |
Sprint | 4.3.0 Sprint 1 [ 49 ] |
Rank | Ranked higher |
Assignee | Tyson Phillips [ tyson ] | Jonathan Reissmueller [ jonathan ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Remaining Estimate | 0 minutes [ 0 ] | |
Time Spent | 39 minutes [ 2340 ] | |
Worklog Id | 10674 [ 10674 ] |
Status | In Progress [ 3 ] | In Review [ 5 ] |
Resolution | Fixed [ 1 ] |
Sprint | 4.3.0 Sprint 1 [ 49 ] | 4.3.0 Sprint 1, 4.3.0 Sprint 2 [ 49, 52 ] |
Rank | Ranked higher |
Sprint | 4.3.0 Sprint 1, 4.3.0 Sprint 2 [ 49, 52 ] | 4.3.0 Sprint 1, 4.3.0 Sprint 2, 4.3.0 Sprint 3 [ 49, 52, 53 ] |
Sprint | 4.3.0 Sprint 1, 4.3.0 Sprint 2, 4.3.0 Sprint 3 [ 49, 52, 53 ] | 4.3.0 Sprint 1, 4.3.0 Sprint 2, 4.3.0 Sprint 3, 4.3.0 Sprint 4 [ 49, 52, 53, 54 ] |
Status | In Review [ 5 ] | Closed [ 6 ] |
Resolution | Fixed [ 1 ] | |
Status | Closed [ 6 ] | Reopened [ 4 ] |
Fix Version/s | 4.3.0-b1 [ 11019 ] |
Security | Private [ 10000 ] |
Status | Reopened [ 4 ] | Closed [ 6 ] |
Resolution | Fixed [ 1 ] |