Created
March 23, 2018 11:24
-
-
Save addiks/b5f159c2335a71d76ffe407af4f908f2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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