diff --git a/src/Entity/PersonInterface.php b/src/Entity/PersonInterface.php index a035c42a0aaf65051c508d0c663c6fd227e2b4f8..cc4ad9659bf1e36731246a035223b96fdb7b84af 100644 --- a/src/Entity/PersonInterface.php +++ b/src/Entity/PersonInterface.php @@ -17,12 +17,4 @@ interface PersonInterface public function getFamilyName(): ?string; public function setFamilyName(string $familyName): void; - - public function getEmail(): ?string; - - public function setEmail(string $email): void; - - public function getBirthDate(): ?string; - - public function setBirthDate(string $birthDate): void; } diff --git a/src/Entity/PersonTrait.php b/src/Entity/PersonTrait.php index 615b18d90b38fdd6853a2add9a01ce4eedf5b6c2..6f627ad26241b6d40f8c10c9f7686f1f02806242 100644 --- a/src/Entity/PersonTrait.php +++ b/src/Entity/PersonTrait.php @@ -26,7 +26,6 @@ trait PersonTrait private $givenName; /** - * @var string * @ApiProperty(iri="http://schema.org/familyName") * @Groups({"BasePerson:output"}) * @@ -38,27 +37,22 @@ trait PersonTrait * @ApiProperty(iri="http://schema.org/email") * @Groups({"BasePerson:output:email"}) * + * @deprecated Request using localData + * * @var string */ private $email; /** - * @var string * @ApiProperty(iri="http://schema.org/birthDate") * @Groups({"BasePerson:output:birthDate"}) + * + * @deprecated Request using localDate + * + * @var string */ private $birthDate; - /** - * @var array - */ - private $extraData; - - public function __construct() - { - $this->extraData = []; - } - public function setIdentifier(string $identifier): void { $this->identifier = $identifier; @@ -89,40 +83,25 @@ trait PersonTrait $this->familyName = $familyName; } + /** @deprecated */ public function getEmail(): ?string { return $this->email; } + /** @deprecated */ public function setEmail(string $email): void { $this->email = $email; } - /** - * Allows attaching extra information to a Person object with - * some random key. You can get the value back via getExtraData(). - * - * @param ?mixed $value - */ - public function setExtraData(string $key, $value): void - { - $this->extraData[$key] = $value; - } - - /** - * @return ?mixed - */ - public function getExtraData(string $key) - { - return $this->extraData[$key] ?? null; - } - + /** @deprecated */ public function getBirthDate(): ?string { return $this->birthDate; } + /** @deprecated */ public function setBirthDate(string $birthDate): void { $this->birthDate = $birthDate; diff --git a/src/Service/DummyPersonProvider.php b/src/Service/DummyPersonProvider.php index 1266354ab12251c2d910192e5710410626cb3a68..1ded94a5a03ac13a4617dabc8902195e339de043 100644 --- a/src/Service/DummyPersonProvider.php +++ b/src/Service/DummyPersonProvider.php @@ -14,11 +14,6 @@ class DummyPersonProvider implements PersonProviderInterface */ private $currentIdentifier; - public function __construct() - { - $this->currentIdentifier = null; - } - public function getPersons(int $currentPageNumber, int $maxNumItemsPerPage, array $options = []): array { $persons = []; @@ -36,7 +31,6 @@ class DummyPersonProvider implements PersonProviderInterface $person->setIdentifier($id); $person->setGivenName('John'); $person->setFamilyName('Doe'); - $person->setEmail('john.doe@example.com'); return $person; } diff --git a/tests/PersonTest.php b/tests/PersonTest.php index bc12293c6786a0c92163994282d13eceb520921f..1506c586569d88abf31639c9dd8f81bdce2fca8d 100644 --- a/tests/PersonTest.php +++ b/tests/PersonTest.php @@ -9,19 +9,6 @@ use PHPUnit\Framework\TestCase; class PersonTest extends TestCase { - public function testExtraData() - { - $person = new Person(); - - $person->setExtraData('foo', 42); - $this->assertSame(42, $person->getExtraData('foo')); - - $person->setExtraData('foo', [1]); - $this->assertSame([1], $person->getExtraData('foo')); - - $this->assertSame(null, $person->getExtraData('nope')); - } - public function testGettersSetters() { $person = new Person(); @@ -37,13 +24,5 @@ class PersonTest extends TestCase $this->assertNull($person->getFamilyName()); $person->setFamilyName('foo'); $this->assertSame('foo', $person->getFamilyName()); - - $this->assertNull($person->getEmail()); - $person->setEmail('foo@invalid.com'); - $this->assertSame('foo@invalid.com', $person->getEmail()); - - $this->assertNull($person->getBirthDate()); - $person->setBirthDate('1970-01-01'); - $this->assertSame('1970-01-01', $person->getBirthDate()); } }