문제

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