Ejemplo n.º 1
0
 /**
  * @return \Symforce\AdminBundle\Compiler\Generator\PhpClass
  */
 public function getCompileClass()
 {
     if (null === $this->_compile_class) {
         $class = new \Symforce\AdminBundle\Compiler\Generator\PhpClass();
         $class->setName('Symforce\\AdminCache\\SymforcePageService')->setParentClassName('\\Symforce\\AdminBundle\\Compiler\\Cache\\SymforcePageServiceCache')->addUseStatement('Symfony\\Component\\PropertyAccess\\PropertyAccessorInterface')->addUseStatement('Symfony\\Component\\HttpFoundation\\Request')->addUseStatement('Symforce\\AdminBundle\\Compiler\\Loader\\AdminLoader')->addUseStatement('Symforce\\AdminBundle\\Controller\\AdminController')->setFinal(true);
         $this->_compile_class = $class;
     }
     return $this->_compile_class;
 }
Ejemplo n.º 2
0
 /**
  * @return \Symforce\AdminBundle\Compiler\Generator\PhpClass
  */
 public function getCompileClass()
 {
     if (null === $this->_compile_class) {
         $class = new \Symforce\AdminBundle\Compiler\Generator\PhpClass();
         $class->setName($this->_compile_class_name)->setParentClassName('\\Symforce\\AdminBundle\\Compiler\\Generator\\RouteWebPageGenerator')->setFinal(true);
         $this->_compile_class = $class;
     }
     return $this->_compile_class;
 }
Ejemplo n.º 3
0
 /**
  * @param string $domain
  * @return ActionGenerator 
  */
 public function getAdminPhpGenerator(\Symforce\AdminBundle\Compiler\MetaType\Admin\Entity $admin)
 {
     $_key = 'admin.' . $admin->name;
     if (isset($this->cached_generators[$_key])) {
         return $this->cached_generators[$_key];
     }
     $class = new \Symforce\AdminBundle\Compiler\Generator\PhpClass();
     $rc = new \ReflectionObject($admin);
     $default_properties = $rc->getDefaultProperties();
     if ($default_properties['parent_class_name'] === $admin->parent_class_name) {
         $parent_name = preg_replace('/\\\\Entity\\\\(\\w+)$/', '\\\\Admin\\\\\\1Admin', $admin->class_name);
         if (class_exists($parent_name)) {
             if (!is_subclass_of($parent_name, "\\Symforce\\AdminBundle\\Compiler\\Cache\\AdminCache")) {
                 throw new \Exception(sprintf("%s admin class %s exists, but not extends from Symforce\\AdminBundle\\Compiler\\Cache\\AdminCache", $admin->class_name, $parent_name));
             }
             $admin->parent_class_name = $parent_name;
         }
     }
     $this->admin_unmaps[$admin->_compile_class_name] = $admin->class_name;
     if ('Symforce\\AdminBundle\\Compiler\\Cache\\AdminCache' !== $admin->parent_class_name) {
         if (isset($this->admin_unmaps[$admin->parent_class_name])) {
             throw new \Exception(sprintf("%s,%s,%s", $admin->parent_class_name, $this->admin_unmaps[$admin->parent_class_name], $admin->class_name));
         }
         $this->admin_unmaps[$admin->parent_class_name] = $admin->class_name;
     }
     $class->setName($admin->_compile_class_name)->setParentClassName('\\' . $admin->parent_class_name)->setFinal(true);
     // $class->addUseStatement('Symfony\Component\Validator\Constraints', 'Assert') ;
     // $class->addUseStatement('Symfony\Bridge\Doctrine\Validator\Constraints', 'DoctrineAssert') ;
     $this->cached_generators[$_key] = $class;
     return $class;
 }