Last active
May 7, 2019 00:51
-
-
Save maciejmiara/32dd4aedb0d400ef39bdb4dd782c3f3e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types = 1); | |
namespace Infrastructure\Framework\Entity; | |
use Doctrine\Common\Collections\ArrayCollection; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* @ORM\Entity | |
* @ORM\Table(name="runners") | |
*/ | |
final class Runner extends User | |
{ | |
/** | |
* @var RunParticipation[] | |
* @ORM\OneToMany(targetEntity="RunParticipation", mappedBy="runner") | |
*/ | |
private $participations; | |
/** | |
* @var RunResult[] | |
* @ORM\OneToMany(targetEntity="RunResult", mappedBy="runner") | |
*/ | |
private $results; | |
public function __construct( | |
string $id, | |
string $email, | |
string $password, | |
array $participations = [], | |
array $results = [] | |
) { | |
$this->participations = new ArrayCollection($participations); | |
$this->results = new ArrayCollection($results); | |
parent::__construct( | |
$id, | |
$email, | |
$password | |
); | |
} | |
/** | |
* @return RunParticipation[] | |
*/ | |
public function getParticipations(): array | |
{ | |
return $this->participations->toArray(); | |
} | |
/** | |
* @return RunResult[] | |
*/ | |
public function getResults(): array | |
{ | |
return $this->results->toArray(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment