samedi 14 février 2015

Creating ReflectionFunction in Zend Framework 2 failed

I am trying to create object from type ReflectionFunction using the static function reflectFunction in Zend\Server\Reflection class. When I call this function from my controller it gives me this error:



Invalid function "userSignIn" passed to reflectFunction



That means that function userSignIn does not exist but this function exist in my TextServer php file.


Here is the code from TextServer class:



public function __construct(){
echo "TextServer: constructor";
parent::__construct();
$this->addUserSignInFunction();
$this->addUserInsertTextFunction();
}

/**
* Creating ReflectionFunction for userSignIn function
*/
public function addUserSignInFunction(){
$function = Reflection::reflectFunction('userSignIn');
$this->addFunction($function);
}

/**
* Creating ReflectionFunction for userInsertText function
*/
public function addUserInsertTextFunction(){
$function = Reflection::reflectFunction('userInsertText');
$this->addFunction($function);
}


Here is the code in the controller:



public function indexAction(){

$s = new TextServer();

return new ViewModel(array('texts' => $this->getTextTable()->fetchAll(),
'users' => $this -> getUserTable()->fetchAll(),
'user_id' => $_SESSION["user_id"]));
}





Aucun commentaire:

Enregistrer un commentaire