TYPO3 will call the class from the controller
I want to call a separate class from my controller.
The class was found under: Classes / Domain / Services I only want to name the getter!
The class I want to call is called TestClass.php
In my controller, I tried: $this->view->assign('options', $this->TestClass->getTest());
Testclass looks like this:
class NoteArrays {
protected $tests= array(
'a' => 'a',
'b' => 'b');
public function getTest() {
return $this->tests;
}
}
But I only have a blank page ...
+3
source to share
1 answer
Soution:
namespace Test\Test\Services\NestedDirectory;
class NoteArrays {
protected $tests= array( 'a' => 'a', 'b' => 'b');
public function getTest() {
return $this->tests;
}
}
And create and assign:
$array = new \Test\Test\Services\NestedDirectory\NoteArrays();
$this->view->assign('options', $array->getTest());
+2
source to share