Slide 29
Slide 29 text
getRepository
public function getRepository($className)
{
if (!array_key_exists($className, $this->repositories)) {
$repositoryName = str_replace(
'Entity', 'Repository', $className
);
$repositoryName .= 'Repository';
$repository = new $repositoryName($this);
$this->repositories[$className] = $repository;
}
return $this->repositories[$className];
}
My\Project\Entity\User
My\Project\Repository\UserRepository