Skip to content

Instantly share code, notes, and snippets.

@BerezhniyDmitro
Created January 14, 2019 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BerezhniyDmitro/764e2d393ed6074000ed0d0c91c493ac to your computer and use it in GitHub Desktop.
Save BerezhniyDmitro/764e2d393ed6074000ed0d0c91c493ac to your computer and use it in GitHub Desktop.
<?php
class MapDocuments
{
private $aliasMap = [
'document.check' => Check::class,
'document.nakladnaya' => Nakladnaya::class, // сущности твои
];
public function getEntity(string $aliasEntity)
{
if (! array_key_exists($aliasEntity, $this->aliasMap)) {
throw new \http\Exception\InvalidArgumentException('Вася ты передал что то не то');
}
return new Nakladnaya();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment