I wanna call a seperate Class from my Controller.
The class is found under: Classes/Domain/Services I wanna call only a getter!
The class I wanna call is named TestClass.php
In my controller I tried: $this->view->assign('options', $this->TestClass->getTest());
The Testclass looks like this:
class NoteArrays {
protected $tests= array(
'a' => 'a',
'b' => 'b');
public function getTest() {
return $this->tests;
}
}
But I've got only a blank page....
Soution is:
namespace Test\Test\Services\NestedDirectory;
class NoteArrays {
protected $tests= array( 'a' => 'a', 'b' => 'b');
public function getTest() {
return $this->tests;
}
}
And to create and assign:
$array = new \Test\Test\Services\NestedDirectory\NoteArrays();
$this->view->assign('options', $array->getTest());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With