Skip to content

Instantly share code, notes, and snippets.

@basz
Last active November 1, 2018 10:50
Show Gist options
  • Select an option

  • Save basz/8ec74b477e4ee6f3cacd7b9feedd400b to your computer and use it in GitHub Desktop.

Select an option

Save basz/8ec74b477e4ee6f3cacd7b9feedd400b to your computer and use it in GitHub Desktop.
SHouldn't be null returned getAggregateRoot
final class DossierAggregateRepository extends AggregateRepository implements DossierRepository
{
public function save(Dossier $dossier): void
{
$this->saveAggregateRoot($dossier);
}
public function get(DossierId $dossierId): ?Dossier
{
$ar = $this->getAggregateRoot((string) $dossierId);
if (get_class($ar) !== Dossier::class) {
return null;
}
return $ar;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment