I have an application with some modules. One of them is CourseSearch
. Now I want to add a further one, the SportsPartnerSearch
. Since these two modules are very similar to each other, I simply "cloned" / copied the CourseSearch
and replaced all "Course" with "SportsPartner" (in all variations: $course
to $sportsPartner
, course-...phtml
to sports-partner-...phtml
etc.), in order to edit the logic in the second step. Now I'm getting following errors:
Warning:
require_once(/path/to/project/module/SportsPartnerSearch//src/CourseSearch/View/Helper/CourseSearchForm.php):
failed to open stream: No such file or directory in
/path/to/project/vendor/zendframework/zendframework/library/Zend/Loader/ClassMapAutoloader.php
on line 140
Fatal error: require_once(): Failed opening required
'/path/to/project/module/SportsPartnerSearch//src/CourseSearch/View/Helper/CourseSearchForm.php'
(include_path='.:/usr/share/php:/usr/share/pear') in
/path/to/project/vendor/zendframework/zendframework/library/Zend/Loader/ClassMapAutoloader.php
on line 140
Why is the path to the file being built in such strange way: /path/to/project/module/
SportsPartnerSearch
//src/
CourseSearch
/View/Helper/CourseSearchForm.php
? Where did I do a mistake?
Some additional information.
The class, that cannot be found because the wron path is CourseSearch\View\Helper\CourseSearchForm
in the CourseSearch module. It can be found, when I deactivate the new module SportsPartnerSearch
, that contains the class SportsPartnerSearch\View\Helper\SportsPartnerSearchForm
.
The CourseSearchForm
view helper is instanciated in the CourseSearchForm\Module
class Module {
public function getViewHelperConfig() {
return array(
'factories' => array(
'courseSearchForm' => function($serviceManager) {
$helper = new View\Helper\CourseSearchForm(array('render' => true, 'redirect' => false));
// ERROR. This code is not executed anymore.
$helper->setViewTemplate('course-search/course-search/course-search-form');
$courseSearchForm = $serviceManager->getServiceLocator()->get('CourseSearch\Form\CourseSearchForm');
$helper->setCourseSearchForm($courseSearchForm);
return $helper;
}
)
);
}
}
And called in the layout file:
echo $this->courseSearchForm();
The SportsPartnerSearch\View\Helper\SportsPartnerSearchForm
is instanciated in the same way in the SportsPartnerSearch\Module#getViewHelperConfig()
and is not called yet.