Skip to content
Snippets Groups Projects
Commit 2848187b authored by Groß-Vogt, Tobias's avatar Groß-Vogt, Tobias
Browse files

deprecated person email and birthdate, removed extraData -> both to be requested using localData

parent 13fa75c3
No related branches found
No related tags found
No related merge requests found
Pipeline #236345 passed
......@@ -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;
}
......@@ -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;
......
......@@ -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;
}
......
......@@ -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());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment