| @@ 150-176 (lines=27) @@ | ||
| 147 | /** |
|
| 148 | * @inheritDoc |
|
| 149 | */ |
|
| 150 | public function bulkUpdateTimeEntriesTags(array $timeEntries, array $tags, $tagAction = \Marek\Toggable\API\Toggl\Values\TagAction::ADD) |
|
| 151 | { |
|
| 152 | $data = array( |
|
| 153 | 'tags' => $tags, |
|
| 154 | 'tag_action' => $tagAction |
|
| 155 | ); |
|
| 156 | ||
| 157 | $request = new BulkUpdateTimeEntriesTags( |
|
| 158 | array( |
|
| 159 | 'timeEntryIds' => $timeEntries, |
|
| 160 | 'data' => $data, |
|
| 161 | ) |
|
| 162 | ); |
|
| 163 | ||
| 164 | $response = $this->delegate($request); |
|
| 165 | ||
| 166 | $entries = array(); |
|
| 167 | foreach ($response->body['data'] as $entry) { |
|
| 168 | $entries[] = $this->hydrator->hydrate($entry, new TimeEntry()); |
|
| 169 | } |
|
| 170 | ||
| 171 | return new TimeEntries( |
|
| 172 | array( |
|
| 173 | 'timeEntries' => $entries, |
|
| 174 | ) |
|
| 175 | ); |
|
| 176 | } |
|
| 177 | ||
| 178 | /** |
|
| 179 | * @inheritdoc |
|
| @@ 132-155 (lines=24) @@ | ||
| 129 | /** |
|
| 130 | * {@inheritdoc} |
|
| 131 | */ |
|
| 132 | public function getWorkspaceProjects($workspaceId, $active = Activity::ACTIVE, $actualHours = 'false', $onlyTemplates = 'false') |
|
| 133 | { |
|
| 134 | $request = new WorkspaceProjectsRequest( |
|
| 135 | array( |
|
| 136 | 'workspaceId' => $this->validate($workspaceId), |
|
| 137 | 'active' => $active, |
|
| 138 | 'actualHours' => $actualHours, |
|
| 139 | 'onlyTemplates' => $onlyTemplates, |
|
| 140 | ) |
|
| 141 | ); |
|
| 142 | ||
| 143 | $response = $this->delegate($request); |
|
| 144 | ||
| 145 | $projects = array(); |
|
| 146 | foreach($response->body as $project) { |
|
| 147 | $projects[] = $this->hydrator->hydrate($project, new Project()); |
|
| 148 | } |
|
| 149 | ||
| 150 | return new WorkspaceProjectsResponse( |
|
| 151 | array( |
|
| 152 | 'projects' => $projects, |
|
| 153 | ) |
|
| 154 | ); |
|
| 155 | } |
|
| 156 | ||
| 157 | /** |
|
| 158 | * {@inheritdoc} |
|