protected function setupTemplate($view = "default", $filename = null)
 {
     $controlReflection = new Nette\Reflection\ClassType(get_class($this));
     $controlDir = dirname($controlReflection->getFileName());
     $filename = $filename ? $controlDir . DIRECTORY_SEPARATOR . $filename : $controlDir . DIRECTORY_SEPARATOR . "{$view}.latte";
     $this->template->setFile($filename);
     return $this->template;
 }
Beispiel #2
0
 protected function getRepositoryList($modelClass)
 {
     $modelReflection = new ClassType($modelClass);
     $builder = $this->getContainerBuilder();
     $builder->addDependency($modelReflection->getFileName());
     $repositories = [];
     foreach ($modelReflection->getAnnotations() as $key => $annotations) {
         if ($key !== 'property-read') {
             continue;
         }
         foreach ($annotations as $annotation) {
             list($class, $name) = preg_split('#\\s+#', $annotation);
             $class = AnnotationsParser::expandClassName($class, $modelReflection);
             if (!class_exists($class)) {
                 throw new RuntimeException("Repository '{$class}' does not exist.");
             }
             $repositories[ltrim($name, '$')] = $class;
         }
     }
     return $repositories;
 }
Beispiel #3
0
 protected function getRepositoryList($modelClass)
 {
     $modelReflection = new ClassType($modelClass);
     $builder = $this->getContainerBuilder();
     $builder->addDependency($modelReflection->getFileName());
     $repositories = [];
     foreach ($modelReflection->getAnnotations() as $key => $annotations) {
         if ($key !== 'property-read') {
             continue;
         }
         foreach ($annotations as $annotation) {
             list($class, $name) = preg_split('#\\s+#', $annotation);
             $class = AnnotationsParser::expandClassName($class, $modelReflection);
             if (!class_exists($class)) {
                 throw new RuntimeException("Class repository '{$class}' does not exist.");
             }
             $repositories[] = ['name' => ltrim($name, '$'), 'serviceName' => $this->prefix('repositories.' . ltrim($name, '$')), 'class' => $class, 'entities' => call_user_func([$class, 'getEntityClassNames'])];
         }
     }
     return $repositories;
 }