|
<?php |
|
|
|
declare (strict_types = 1); |
|
|
|
namespace App\Infrastructure\Entity; |
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
use Doctrine\ORM\Mapping as ORM; |
|
use App\Infrastructure\HasDomainModel; |
|
use App\Domain; |
|
|
|
|
|
/** |
|
* @ORM\Entity |
|
*/ |
|
final class Program |
|
{ |
|
use HasDomainModel; |
|
|
|
/** |
|
* @ORM\Id |
|
* @ORM\Column(type="string", length=36) |
|
*/ |
|
private $id; |
|
|
|
/** |
|
* @ORM\Column(type="string") |
|
*/ |
|
private $description; |
|
|
|
/** |
|
* @ORM\Column(type="integer") |
|
*/ |
|
private $maxParticipants; |
|
|
|
/** |
|
* @ORM\ManyToMany(targetEntity="Participant", cascade={"persist"}) |
|
*/ |
|
private $participants; |
|
|
|
public function __construct() |
|
{ |
|
$this->participants = new ArrayCollection(); |
|
} |
|
|
|
public function getId() |
|
{ |
|
return $this->id; |
|
} |
|
|
|
public function getDescription() |
|
{ |
|
return $this->description; |
|
} |
|
|
|
public function setDescription($description) |
|
{ |
|
$this->description = $description; |
|
} |
|
|
|
public function getMaxParticipants() |
|
{ |
|
return $this->maxParticipants; |
|
} |
|
|
|
public function setMaxParticipants($maxParticipants) |
|
{ |
|
$this->maxParticipants = $maxParticipants; |
|
} |
|
|
|
public function getParticipants() |
|
{ |
|
return $this->participants; |
|
} |
|
|
|
public function setParticipants($participants) |
|
{ |
|
$this->participants = $participants; |
|
} |
|
|
|
private function getDomainModelClass(): string |
|
{ |
|
return Domain\Program::class; |
|
} |
|
|
|
private function getDomainMapping(): array |
|
{ |
|
return [ |
|
'id' => 'programId', |
|
'description' => 'description', |
|
'maxParticipants' => 'maxParticipants', |
|
]; |
|
} |
|
|
|
private function getPropertyMapper(): array |
|
{ |
|
return [ |
|
'id' => function(Program $entity) { |
|
return Domain\ProgramId::fromString($entity->getId()); |
|
}, |
|
]; |
|
} |
|
} |