瀏覽代碼

Inject class from configuration

Pascal Burkhard 14 年之前
父節點
當前提交
6eb6187d47
共有 2 個文件被更改,包括 3 次插入2 次删除
  1. 2 1
      Admin/Admin.php
  2. 1 1
      Admin/Pool.php

+ 2 - 1
Admin/Admin.php

@@ -180,9 +180,10 @@ abstract class Admin extends ContainerAware
 
     }
 
-    public function __construct($code, ContainerInterface $container)
+    public function __construct($code, ContainerInterface $container, $class)
     {
         $this->code = $code;
+        $this->class = $class;
         
         $this->setContainer($container);
         $this->configure();

+ 1 - 1
Admin/Pool.php

@@ -148,7 +148,7 @@ class Pool
     {
         $class = $configuration['class'];
         
-        $instance = new $class($code, $this->getContainer());
+        $instance = new $class($code, $this->getContainer(), $configuration['entity']);
         $instance->setLabel($configuration['label']);
 
         if(isset($configuration['children'])) {