Last active
July 24, 2016 18:33
-
-
Save JiNexus/24f47bb4d06f851801195baba6dbf843 to your computer and use it in GitHub Desktop.
Unable to resolve service "Zend\ServiceManager\ServiceLocatorInterface" to a factory; are you certain you provided it during configuration?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository | |
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com) | |
* @license http://framework.zend.com/license/new-bsd New BSD License | |
*/ | |
namespace Application; | |
use Zend\Router\Http\Literal; | |
use Zend\Router\Http\Segment; | |
use Zend\ServiceManager\Factory\InvokableFactory; | |
use Application\Factory\TestFactory; | |
return [ | |
'router' => [ | |
'routes' => [ | |
'home' => [ | |
'type' => Literal::class, | |
'options' => [ | |
'route' => '/', | |
'defaults' => [ | |
'controller' => Controller\IndexController::class, | |
'action' => 'index', | |
], | |
], | |
], | |
'test' => [ | |
'type' => Literal::class, | |
'options' => [ | |
'route' => '/test', | |
'defaults' => [ | |
'controller' => Controller\TestController::class, | |
'action' => 'index', | |
], | |
], | |
], | |
'application' => [ | |
'type' => Segment::class, | |
'options' => [ | |
'route' => '/application[/:action]', | |
'defaults' => [ | |
'controller' => Controller\IndexController::class, | |
'action' => 'index', | |
], | |
], | |
], | |
], | |
], | |
'controllers' => [ | |
'invokables' => array( | |
// 'Application\Controller\Test' => Controller\TestController::class, | |
), | |
'factories' => [ | |
Controller\IndexController::class => InvokableFactory::class, | |
Controller\TestController::class => TestFactory::class, | |
], | |
], | |
'view_manager' => [ | |
'display_not_found_reason' => true, | |
'display_exceptions' => true, | |
'doctype' => 'HTML5', | |
'not_found_template' => 'error/404', | |
'exception_template' => 'error/index', | |
'template_map' => [ | |
'layout/layout' => __DIR__ . '/../view/layout/layout.phtml', | |
'application/index/index' => __DIR__ . '/../view/application/index/index.phtml', | |
'error/404' => __DIR__ . '/../view/error/404.phtml', | |
'error/index' => __DIR__ . '/../view/error/index.phtml', | |
], | |
'template_path_stack' => [ | |
__DIR__ . '/../view', | |
], | |
], | |
'navigation' => [ | |
'default' => [ | |
[ | |
'label' => 'Home', | |
'route' => 'home', | |
], | |
[ | |
'label' => 'Test', | |
'route' => 'test', | |
], | |
[ | |
'label' => 'Album', | |
'route' => 'album', | |
'pages' => [ | |
[ | |
'label' => 'Add', | |
'route' => 'album', | |
'action' => 'add', | |
], | |
[ | |
'label' => 'Edit', | |
'route' => 'album', | |
'action' => 'edit', | |
], | |
[ | |
'label' => 'Delete', | |
'route' => 'album', | |
'action' => 'delete', | |
], | |
], | |
], | |
], | |
], | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository | |
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com) | |
* @license http://framework.zend.com/license/new-bsd New BSD License | |
*/ | |
namespace Application; | |
// use Zend\Mvc\ModuleRouteListener; | |
// use Zend\Mvc\MvcEvent; | |
class Module | |
{ | |
const VERSION = '3.0.0dev'; | |
public function getConfig() | |
{ | |
return include __DIR__ . '/../config/module.config.php'; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository | |
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com) | |
* @license http://framework.zend.com/license/new-bsd New BSD License | |
*/ | |
namespace Application\Controller; | |
use Zend\Mvc\Controller\AbstractActionController; | |
use Zend\View\Model\ViewModel; | |
use Zend\ServiceManager\ServiceLocatorInterface; | |
class TestController extends AbstractActionController | |
{ | |
private $serviceLocator; | |
public function __construct(ServiceLocatorInterface $serviceLocator) | |
{ | |
$this->serviceLocator = $serviceLocator; | |
} | |
public function indexAction() | |
{ | |
echo '<pre>'; | |
var_dump('index'); | |
echo '</pre>'; | |
return new ViewModel(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Application\Factory; | |
use Zend\ServiceManager\ServiceLocatorInterface; | |
use Interop\Container\ContainerInterface; | |
use Application\Controller\TestController; | |
class TestFactory | |
{ | |
public function __invoke(ContainerInterface $container, $requestedName, array $options = null) | |
{ | |
return new TestController($container->get(ServiceLocatorInterface::class)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment