Skip to content

Instantly share code, notes, and snippets.

@addiks
Created March 23, 2018 11:24
Show Gist options
  • Save addiks/b5f159c2335a71d76ffe407af4f908f2 to your computer and use it in GitHub Desktop.
Save addiks/b5f159c2335a71d76ffe407af4f908f2 to your computer and use it in GitHub Desktop.
<?php
interface MyEntityInterface
{
function foo(string $a): int;
function bar(int $b): string;
}
final class MyEntity implements MyEntityInterface
{
function foo(string $a): int
{
# ...
}
function bar(int $b): string
{
# ...
}
}
final class MyEntityProxy implements MyEntityInterface
{
public function __construct(MyEntity $innerEntity, DoctrineHydratorThingyAndStuff $hydrator)
{
$this->innerEntity = $innerEntity;
$this->hydrator = $hydrator;
}
function foo(string $a): int
{
return $this->hydrator->hydrateEntity($innerEntity)->foo($a);
}
function bar(int $b): string
{
return $this->hydrator->hydrateEntity($innerEntity)->bar($b);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment