Skip to content

Commit e64d379

Browse files
committed
Only return full information (not stub information) from getProject()
1 parent 346a46d commit e64d379

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

src/PlatformClient.php

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Platformsh\Client\Model\Organization\Organization;
1212
use Platformsh\Client\Model\Plan;
1313
use Platformsh\Client\Model\Project;
14+
use Platformsh\Client\Model\ProjectStub;
1415
use Platformsh\Client\Model\Region;
1516
use Platformsh\Client\Model\Catalog;
1617
use Platformsh\Client\Model\Result;
@@ -64,13 +65,6 @@ private function apiUrl()
6465
*/
6566
public function getProject($id, $hostname = null, $https = true)
6667
{
67-
// Search for a project in the user's project list.
68-
foreach ($this->getProjects() as $project) {
69-
if ($project->id === $id) {
70-
return $project;
71-
}
72-
}
73-
7468
// Look for a project directly if the hostname is known.
7569
if ($hostname !== null) {
7670
return $this->getProjectDirect($id, $hostname, $https);
@@ -101,6 +95,8 @@ public function getProject($id, $hostname = null, $https = true)
10195
/**
10296
* Get the logged-in user's projects.
10397
*
98+
* @deprecated replaced by getProjectStubs()
99+
*
104100
* @param bool $reset
105101
*
106102
* @return Project[]
@@ -123,6 +119,18 @@ public function getProjects($reset = false)
123119
return $projects;
124120
}
125121

122+
/**
123+
* Returns the logged-in user's project stubs.
124+
*
125+
* @param bool $reset
126+
*
127+
* @return ProjectStub[]
128+
*/
129+
public function getProjectStubs($reset = false)
130+
{
131+
return ProjectStub::wrapCollection($this->getAccountInfo($reset), $this->apiUrl(), $this->connector->getClient());
132+
}
133+
126134
/**
127135
* Get account information for the logged-in user.
128136
*

0 commit comments

Comments
 (0)