我收到以下错误:
ERROR:
Warning: Missing argument 2 for Agc\ManagerBundle\Lib\grafica::__construct
(), called in C:\wamp\www\galileo\src\Agc\ManagerBundle\Controller\DefaultController.php on line 101
and defined in C:\wamp\www\galileo\src\Agc\ManagerBundle\Lib\grafica.php line 10
我的班级grafica
:
class grafica
{
protected $conn;
protected $bdnmgi;
function __construct($conn, $esq)
{
$this->conn = $conn;
$this->bdnmgi = $esq;
}
我从DefaultController
致电新对象grafica:
$grafica = new grafica($this->get('database_connection'), $esquema);
问题在于,当我尝试创建新的grafica
实例时,构造函数无法识别我的var $esquema
。知道为什么会这样吗?
谢谢。
好的,以下是创建图形的上述行:
class DefaultController extends Controller
{
public function dashboardAction(Request $peticion)
{
$em = $this->getDoctrine()->getManager('customer_1');
$user= $this->get('security.context')->getToken()->getUser();
$esquema = $user->getAdministracion()->getNombreEsquemamgi();
var_dump($esquema);
$grafica = new grafica($this->get('database_connection'), $esquema)