[TYPO3-mvc] Implement Services using namespaces?
Domi
djgarms at gmail.com
Fri Jun 14 03:30:11 CEST 2013
Hi Felix
> 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 {
> .
> }
You missed the namespace declaration?
<?PHP
namespace \Vendor\Extension\Service;
class AbcService implements \TYPO3\CMS\Core\SingletonInterface {
(...)
?>
Injecting got way easier with @inject, you don't need to write the
public function:
/**
* @var \Vendor\Extension\Service\AbcService
* @inject
> */
> protected $abcService;
Thats it :)
Hope this helps,
Dominic
More information about the TYPO3-project-typo3v4mvc
mailing list