Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#65] Deprecate "createdBy" and "lastModifiedBy" properties #74

16 changes: 16 additions & 0 deletions src/Entity/CommonEntityPropertiesAwareTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ trait CommonEntityPropertiesAwareTrait
/**
* Email address of the organization user who created the entity.
*
* @deprecated Not used in Hybrid orgs.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we used a similar, standardized format like Drupal 8 introduced which tells a deveoper which version XY was deprecated and when it will be removed? Also, if there is any replacement for the class/method/etc a developer can get information about it?

https://github.com/drupal/core/blob/b3273887e822d745ed277ce36cd07dc56e795d83/includes/file.inc#L49

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed it to:

@deprecated in 2.0.4, will be removed before 3.0.0. Unsupported in Hybrid.
@see https://github.com/apigee/apigee-client-php/issues/65

2.0.4 should be the next release.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsupported in Hybrid.

What does it mean exactly? What happens if I call these methods on an object returned from a hybrid org? Do they return an empty string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mxr576 The fields are empty so calling the methods would return NULL, as they are never initialized.

*
* @see https://github.com/apigee/apigee-client-php/issues/65
*
* @var string|null
*/
protected $createdBy;
Expand All @@ -50,6 +54,10 @@ trait CommonEntityPropertiesAwareTrait
/**
* Email address of the organization user who modified the entity last time.
*
* @deprecated Not used in Hybrid orgs.
*
* @see https://github.com/apigee/apigee-client-php/issues/65
*
* @var string|null
*/
protected $lastModifiedBy;
Expand Down Expand Up @@ -88,6 +96,10 @@ public function getCreatedBy(): ?string
* @param string $email
* User/developer mail.
*
* @deprecated Not used in Hybrid orgs.
*
* @see https://github.com/apigee/apigee-client-php/issues/65
*
* @internal
*/
public function setCreatedBy(string $email): void
Expand Down Expand Up @@ -130,6 +142,10 @@ public function getLastModifiedBy(): ?string
* User/developer mail.
*
* @internal
*
* @deprecated Not used in Hybrid orgs.
*
* @see https://github.com/apigee/apigee-client-php/issues/65
*/
public function setLastModifiedBy(string $email): void
{
Expand Down
8 changes: 8 additions & 0 deletions src/Entity/CommonEntityPropertiesInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public function getCreatedAt(): ?\DateTimeImmutable;
/**
* Returns the email address of the user/developer who created the entity.
*
* @deprecated Not used in Hybrid orgs.
*
* @see https://github.com/apigee/apigee-client-php/issues/65
*
* @return string|null Email address.
*/
public function getCreatedBy(): ?string;
Expand All @@ -52,6 +56,10 @@ public function getLastModifiedAt(): ?\DateTimeImmutable;
/**
* Returns the email address of the user/developer who modified the entity the last time.
*
* @deprecated Not used in Hybrid orgs.
*
* @see https://github.com/apigee/apigee-client-php/issues/65
*
* @return string|null Email address.
*/
public function getLastModifiedBy(): ?string;
Expand Down
2 changes: 0 additions & 2 deletions tests/Api/Management/Controller/DeveloperControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ public function testGetDeveloperByApp(): void
$developer = (object) [
'createdAt' => time() * 1000,
'lastModifiedAt' => time() * 1000,
'createdBy' => 'phpunit@example.com',
'lastModifiedBy' => 'phpunit@example.com',
'name' => 'phpunit',
'firstName' => 'phpunit',
'lastName' => 'phpunit',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,5 @@ public function testLoad(): void
$this->assertEquals('trial', $entity->getType());
$this->assertEquals(new \DateTimeImmutable('@648345600'), $entity->getCreatedAt());
$this->assertEquals(new \DateTimeImmutable('@648345600'), $entity->getLastModifiedAt());
$this->assertEquals('phpunit@example.com', $entity->getCreatedBy());
$this->assertEquals('phpunit@example.com', $entity->getLastModifiedBy());
}
}
2 changes: 0 additions & 2 deletions tests/Controller/PaginationHelperTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ protected function getOrgLoadResponsePayload(bool $cpsEnabled = true): string
$org = [
'createdAt' => time() * 1000,
'lastModifiedAt' => time() * 1000,
'createdBy' => 'phpunit@example.com',
'lastModifiedBy' => 'phpunit@example.com',
'displayName' => 'phpunit',
'name' => 'phpunit',
'environments' => [],
Expand Down
2 changes: 0 additions & 2 deletions tests/offline-test-data/v1/organizations/phpunit/GET.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
{
"createdAt": 648345600000,
"createdBy": "phpunit@example.com",
"displayName": "PHPUnit",
"environments": [
"prod",
"test"
],
"lastModifiedAt": 648345600000,
"lastModifiedBy": "phpunit@example.com",
"name": "phpunit",
"properties": {
"property": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
}
],
"createdAt": 648345600000,
"createdBy": "phpunit@example.com",
"description": "",
"displayName": "PHP Unit Test product",
"environments": [],
"lastModifiedAt": 648345600000,
"lastModifiedBy": "phpunit@example.com",
"name": "3phpunit_test",
"proxies": [],
"quota": "10",
Expand All @@ -36,12 +34,10 @@
}
],
"createdAt": 648345600000,
"createdBy": "phpunit@example.com",
"description": "",
"displayName": "PHP Unit Test product",
"environments": [],
"lastModifiedAt": 648345600000,
"lastModifiedBy": "phpunit@example.com",
"name": "4phpunit_test",
"proxies": [],
"quota": "10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
}
],
"createdAt": 648345600000,
"createdBy": "phpunit@example.com",
"description": "",
"displayName": "PHP Unit Test product",
"environments": [],
"lastModifiedAt": 648345600000,
"lastModifiedBy": "phpunit@example.com",
"name": "4phpunit_test",
"proxies": [],
"quota": "10",
Expand All @@ -36,12 +34,10 @@
}
],
"createdAt": 648345600000,
"createdBy": "phpunit@example.com",
"description": "",
"displayName": "PHP Unit Test product",
"environments": [],
"lastModifiedAt": 648345600000,
"lastModifiedBy": "phpunit@example.com",
"name": "5phpunit_test",
"proxies": [],
"quota": "10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
}
],
"createdAt": 648345600000,
"createdBy": "phpunit@example.com",
"description": "",
"displayName": "PHP Unit Test product",
"environments": [],
"lastModifiedAt": 648345600000,
"lastModifiedBy": "phpunit@example.com",
"name": "5phpunit_test",
"proxies": [],
"quota": "10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
}
],
"createdAt": 648345600000,
"createdBy": "phpunit@example.com",
"description": "",
"displayName": "PHP Unit Test product",
"environments": [],
"lastModifiedAt": 648345600000,
"lastModifiedBy": "phpunit@example.com",
"name": "phpunit_test",
"proxies": [],
"quota": "10",
Expand All @@ -36,12 +34,10 @@
}
],
"createdAt": 648345600000,
"createdBy": "phpunit@example.com",
"description": "",
"displayName": "PHP Unit Test product",
"environments": [],
"lastModifiedAt": 648345600000,
"lastModifiedBy": "phpunit@example.com",
"name": "1phpunit_test",
"proxies": [],
"quota": "10",
Expand All @@ -62,12 +58,10 @@
}
],
"createdAt": 648345600000,
"createdBy": "phpunit@example.com",
"description": "",
"displayName": "PHP Unit Test product",
"environments": [],
"lastModifiedAt": 648345600000,
"lastModifiedBy": "phpunit@example.com",
"name": "2phpunit_test",
"proxies": [],
"quota": "10",
Expand All @@ -88,12 +82,10 @@
}
],
"createdAt": 648345600000,
"createdBy": "phpunit@example.com",
"description": "",
"displayName": "PHP Unit Test product",
"environments": [],
"lastModifiedAt": 648345600000,
"lastModifiedBy": "phpunit@example.com",
"name": "3phpunit_test",
"proxies": [],
"quota": "10",
Expand All @@ -114,12 +106,10 @@
}
],
"createdAt": 648345600000,
"createdBy": "phpunit@example.com",
"description": "",
"displayName": "PHP Unit Test product",
"environments": [],
"lastModifiedAt": 648345600000,
"lastModifiedBy": "phpunit@example.com",
"name": "4phpunit_test",
"proxies": [],
"quota": "10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
}
],
"createdAt": 648345600000,
"createdBy": "phpunit@example.com",
"displayName": "PHP Unit Test product",
"environments": [],
"lastModifiedAt": 648345600000,
"lastModifiedBy": "phpunit@example.com",
"name": "phpunit_test",
"proxies": [],
"quota": "10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
}
],
"createdAt": 648345600000,
"createdBy": "phpunit@example.com",
"displayName": "PHP Unit Test product",
"environments": [],
"lastModifiedAt": 648345600000,
"lastModifiedBy": "phpunit@example.com",
"name": "phpunit_test",
"proxies": [],
"quota": "10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@
}
],
"createdAt": 648345600000,
"createdBy": "phpunit@example.com",
"displayName": "(Edited) PHP Unit Test product",
"environments": [],
"lastModifiedAt": 648345600000,
"lastModifiedBy": "phpunit@example.com",
"name": "phpunit_test",
"proxies": [],
"quota": "1000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
],
"callbackUrl": "http://example.com",
"createdAt": 648345600000,
"createdBy": "phpunit@example.com",
"credentials": [
{
"apiProducts": [],
Expand All @@ -31,7 +30,6 @@
],
"developerId": "f43ffa3c-e147-47de-8cd6-f5b34429a531",
"lastModifiedAt": 648345600000,
"lastModifiedBy": "phpunit@example.com",
"name": "phpunit_test_app",
"scopes": [],
"status": "approved"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
],
"callbackUrl": "http://example.com",
"createdAt": 648345600000,
"createdBy": "phpunit@example.com",
"credentials": [
{
"apiProducts": [],
Expand All @@ -31,7 +30,6 @@
],
"companyName": "phpunit",
"lastModifiedAt": 648345600000,
"lastModifiedBy": "phpunit@example.com",
"name": "phpunit_test_app",
"scopes": [],
"status": "approved"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
}
],
"createdAt": 648345600000,
"createdBy": "phpunit@example.com",
"lastModifiedAt": 648345600000,
"lastModifiedBy": "phpunit@example.com"
"lastModifiedAt": 648345600000
},
{
"apps": [],
Expand All @@ -28,9 +26,7 @@
}
],
"createdAt": 648345600000,
"createdBy": "phpunit@example.com",
"lastModifiedAt": 648345600000,
"lastModifiedBy": "phpunit@example.com"
"lastModifiedAt": 648345600000
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
}
],
"createdAt": 648345600000,
"createdBy": "phpunit@example.com",
"lastModifiedAt": 648345600000,
"lastModifiedBy": "phpunit@example.com"
"lastModifiedAt": 648345600000
},
{
"apps": [],
Expand All @@ -28,9 +26,7 @@
}
],
"createdAt": 648345600000,
"createdBy": "phpunit@example.com",
"lastModifiedAt": 648345600000,
"lastModifiedBy": "phpunit@example.com"
"lastModifiedAt": 648345600000
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
}
],
"createdAt": 648345600000,
"createdBy": "phpunit@example.com",
"lastModifiedAt": 648345600000,
"lastModifiedBy": "phpunit@example.com"
"lastModifiedAt": 648345600000
}
]
}
Loading