سؤال

The method used in typo3 4.7 for calling service from controller(inject method) does not working in TYPO3 6.x

هل كانت مفيدة؟

المحلول

Since inject will not work in extbase 6.0 for TYPO3 6.X

Need to use namespace

Example..

File used for service contain following code(ext name is registration,and vendor name is TYPO3)

registration/Classes/Service/UserService.php contain following code

namespace TYPO3\Registration\Service;

class UserService implements \TYPO3\CMS\Core\SingletonInterface {

    public function addUser($args){
    return 'service called';
    }
}

Call this service from controller

 /**
 * @var \TYPO3\Registration\Service\UserService
 * @inject
 */
 protected $userService;

And from this object $userService , you can call the addUser Method of the Service

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top