this amazing calendar을 내 프로젝트에 통합하려고합니다. 나는 서비스 문제에 곤란을 겪는다.컨트롤러 클래스에서 서비스 클래스를 사용하는 방법은 무엇입니까?
application/
modules/
agenda/
controllers/
CalendarController.php
models/
services/
CalendarService.php
views/
filters/
helpers/
scripts/
calendar/
view-calendar.php
module2/
module3/
I 노선이 내 application.ini에서이 방식 : 나는 구조의이 종류 사용하고
resources.router.routes.agenda.route = /apps/agenda/
resources.router.routes.agenda.defaults.module = agenda
resources.router.routes.agenda.defaults.controller = calendar
resources.router.routes.agenda.defaults.action = view
내가 내 브라우저를 지적를, 나는이 메시지를 얻을 :
Message: Invalid controller class ("Agenda_CalendarController")
을
Agenda_ 접미사로 수정하고 브라우저를 새로 고침했습니다. 가져옴 :
Message: Controller "Agenda_CalendarController" is not an instance of Zend_Controller_Action_Interface
그래서 "extends Zend_Controller_Action"으로 인스턴스를 생성했습니다. 가져옴 : :-)
Fatal error: Class 'Service_Calendar' not found in /home/[PATH TO MY APP FOLDER]/application/modules/agenda/controllers/CalendarController.php on line 30
무엇이 잘못 됐는지 알 수 없습니다. 어떤 사람은 나에게 2 가지 힌트를 가지고 있습니다 :-)
참고 : 의미가 있는지는 잘 모르겠지만 NetBeans를 사용하고 컨트롤러 클래스에서 서비스 클래스 메서드를 가리키고있는 동안 Ctrl 키를 누른 경우, 관련 팝업 정보가 정확합니다.
해결책 : 감사합니다. 당신은 나에게 더 먼 길을 가르쳐주었습니다. 모듈 부트 스트래핑이 제대로 설정되지 않았습니다. 당신의 힌트와 함께 Bob Allen으로부터이 게시물을 발견했습니다. Bob Allen은 같은 문제를 설명합니다.
당신이 찾고있는 무슨 ...
감사합니다 :-) 알게되면, 내 문제가 해결 된 내가 좀 더 알아!
'application/modules/agenda/services/CalendarService.php'를'application/services/Calendar.php'로 옮기고 클래스를 찾는 행운이 있는지보십시오. 애플리케이션 네임 스페이스 (예 : Application_Service_Calendar)를 사용하여 클래스의 이름을 바꿔야 할 수 있습니다. – drew010