[TYPO3-mvc] Implement Services using namespaces?
Felix Eggbert
eggbert at phez.com
Thu Jun 13 19:29:33 CEST 2013
Hey all,
I'm still struggling with namespaces.
I am currently trying to implement a service but I keep getting errors like
"Class Vendor\Extension\Service\AbcService does not exist".
This is my approach:
Service /typo3conf/ext/extension/Classes/Service/AbcService.php:
============================================================================
====
class AbcService implements \TYPO3\CMS\Core\SingletonInterface {
.
}
Inject service in controller:
============================================================================
====
/**
* @var \Vendor\Extension\Service\AbcService
*/
protected $abcService;
/**
* @param \Vendor\Extension\Service\AbcService $abcService
* @return void
*/
public function
injectAccessControlService(\Vendor\Extension\Service\AbcService $abcService)
{
$this->abcService = $abcService;
}
This results in "Class Vendor\Extension\Service\AbcService does not exist".
Not 100% sure if I can inject a service like this, too (which would
definitely make sense IMHO) but I also tried:
/**
* @var \Vendor\Extension\Service\AbcService
* @inject
*/
protected $abcService;
Which leads to "Could not analyse class:Vendor\Extension\Service\AbcService
maybe not loaded or no autoloader?". But I guess this is just another
expression of the same error due to the same cause.
What am I doing wrong, can anybody help?
Thanks a lot and best regards,
Felix
More information about the TYPO3-project-typo3v4mvc
mailing list