How do I access variables of another controller
?
For example:
I have controller X
, and in action index
, I create a variable (or a constant).
From controller Y
, I want to access the value of the variable (or constant) of controller X
.
Is it possible to do this?
Remembering that each action of each controller
, in my application, will have a variable that should be accessible from another controller
.
ExampleX Controller
class ExemploXController
{
$dependencias = array("index","listar");
public function index()
{
echo "Index";
}
public function funcaoX()
{
echo "Funcão X";
}
public function listar()
{
echo "listando";
}
}
Controller ExampleY
class ExemploYController
{
$dependencias = array("index","atualizar");
public function index()
{
//pegar o valor da variável $dependencias da controller ExemploXController
$dependency[] = ExemploXController->dependencias;
}
public function funcaoY()
{
echo "Funcão Y";
}
public function atualizar()
{
echo "atualizar";
}
}