Created
February 13, 2015 13:21
-
-
Save guiwoda/da0ab1c8df2bae2b8c7f to your computer and use it in GitHub Desktop.
Delegate creation responsibility to EM / Repos
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 | |
class FooRepository extends EntityRepository implements FooRepositoryInterface | |
{ | |
public function startFooing($bar, $baz) | |
{ | |
$em = $this->getEntityManager(); | |
// Let's imagine we could | |
$foo = $em->create(Foo::class, [$bar, $baz]); | |
// And EM could resolve other dependencies (like the Emitter) | |
return $foo; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment