Skip to content

Instantly share code, notes, and snippets.

@maciejmiara
Last active May 7, 2019 00:51
Show Gist options
  • Save maciejmiara/32dd4aedb0d400ef39bdb4dd782c3f3e to your computer and use it in GitHub Desktop.
Save maciejmiara/32dd4aedb0d400ef39bdb4dd782c3f3e to your computer and use it in GitHub Desktop.
<?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