linked-swissbib / vufind

A library resource discovery portal designed and developed for libraries by libraries
GNU General Public License v2.0
1 stars 2 forks source link

Create new controller `ExploreAuthor` #6

Closed ltog closed 8 years ago

ltog commented 9 years ago

A new controller named ExploreAuthor shall be created to generate a page that looks identical to the existing Exploration/Author page. A unique author id shall be used as a parameter to specify the author. Since this is not available yet, as a temporary workaround and to learn how to do searches, the given action/parameter shall be searched for (as an author name) and the first result shall be put where we currently hardcoded the author's name.

ltog commented 9 years ago

A page describing controllers and routes: http://framework.zend.com/manual/2.3/en/user-guide/routing-and-controllers.html

ltog commented 9 years ago

Created a new branch for this issue: https://github.com/linked-swissbib/vufind/tree/exploreauthor

ltog commented 9 years ago

Commit 5b5982a produces an exception:

VuFind\Search\Results\PluginManager::get was unable to fetch or create an instance for ExploreAuthor

Backtrace:

#0 /usr/local/vufind/httpd/vendor/zendframework/zendframework/library/Zend/ServiceManager/AbstractPluginManager.php(103): Zend\ServiceManager\ServiceManager->get('ExploreAuthor', true)
#1 /usr/local/vufind/httpd/module/VuFind/src/VuFind/Controller/AbstractSearch.php(235): Zend\ServiceManager\AbstractPluginManager->get('ExploreAuthor')
#2 /usr/local/vufind/httpd/module/LinkedSwissbib/src/LinkedSwissbib/Controller/ExploreAuthorController.php(20): VuFind\Controller\AbstractSearch->resultsAction()
#3 /usr/local/vufind/httpd/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractActionController.php(83): LinkedSwissbib\Controller\ExploreAuthorController->showAction()
#4 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#5 /usr/local/vufind/httpd/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#6 /usr/local/vufind/httpd/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#7 /usr/local/vufind/httpd/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractController.php(116): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#8 /usr/local/vufind/httpd/vendor/zendframework/zendframework/library/Zend/Mvc/DispatchListener.php(113): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#9 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#10 /usr/local/vufind/httpd/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#11 /usr/local/vufind/httpd/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#12 /usr/local/vufind/httpd/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php(313): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#13 /usr/local/vufind/httpd/public/index.php(59): Zend\Mvc\Application->run()
#14 {main}
ltog commented 9 years ago

http://stackoverflow.com/a/21833699 mentions a function getObjectManager() inside the Controller. If it isn't defined, the Controller assumes it to be a ControllerPlugin and therefore asks the ControllerPluginManager to create an instance for this plugin. But no such Plugin was ever registered and therefore one sees this error.

Except for ./vendor/zf-commons/zfc-rbac/tests/ZfcRbacTest/Role/ObjectRepositoryRoleProviderTest.php the function getObjectManager() isn't used in the linked-swissbib/vufind repository, therefore I assume creating a ControllerPlugin is the right thing to do.

ltog commented 9 years ago

Was ist der Unterschied zwischen VuFind\Controller\AbstractSearch --|> VuFind\Controller\AbstractBase --|> Zend\Mvc\Controller\AbstractActionController wie es ElasticSearchController verwendet und Zend\Mvc\Controller\Plugin\AbstractPlugin, wie es unter http://stackoverflow.com/a/19866476 empfohlen wird?

ltog commented 9 years ago

Commit 62d4213 changed the error message from

VuFind\Search\Results\PluginManager::get was unable to fetch or create an instance for ExploreAuthor

to

LinkedSwissbib\Search\Results\PluginManager::get was unable to fetch or create an instance for ExploreAuthor 
ltog commented 9 years ago

Stackoverflow Beiträge zur Fehlermeldung: