public function getRepository($className) { if (!isset($this->repositories[$className])) { throw new InvalidArgumentException("Repository '{$className}' not defined."); } return $this->repositories[$className]; }