phalcon/album-o-rama

application don't have service 'view' in dependency injection container

Closed this issue · 5 comments

step to reproduce:

  • open album-o-orama in browser
  • error message
    "Service 'view' wasn't found in the dependency injection container" will appear

This app is ok, check this out
http://album-o-rama.phalconphp.com/

Check that your re-write rules are correctly configured

hmm, strange..
I just using default .htaccess from album-o-rama

.htaccess:

RewriteEngine On
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]

public/.htaccess:
AddDefaultCharset UTF-8

RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]

System: Mac Lion 10.7, Bitnami MAMP php 5.4.12, phalcon 1.0.1

I will check it in my windows box tonight.

if you enter a non-existent route, the processing will not transfer to the module default and then in DI is established view and we always get the error "Service 'view' wasn't found in the dependency injection container".
Here's an example: http://album-o-rama.phalconphp.com/popular2

This example does not provide a not-found handler, that's why that message appears. You can add a not-found handler following this example: http://docs.phalconphp.com/en/latest/reference/routing.html#not-found-paths

I tried :
public/Index.php
$url->setBaseUri('/');

routes.php

removeExtraSlashes(true); /** - Frontend routes */ $router->add('', array( 'module' => 'frontend', 'namespace' => 'AlbumOrama\Frontend\Controllers\', 'controller' => 'index', 'action' => 'index' )); $router->add('/', array( 'module' => 'frontend', 'namespace' => 'AlbumOrama\Frontend\Controllers\', 'controller' => 'index', 'action' => 'index' )); $router->add('/index', array( 'module' => 'frontend', 'namespace' => 'AlbumOrama\Frontend\Controllers\', 'controller' => 'index', 'action' => 'index' )); $router->notFound(array( 'module' => 'frontend', 'namespace' => 'AlbumOrama\Frontend\Controllers\', 'controller' => 'index', 'action' => 'route404' )); $router->add('/artist/{id:[0-9]+}/{name}', array( 'module' => 'frontend', 'namespace' => 'AlbumOrama\Frontend\Controllers\', 'controller' => 'catalog', 'action' => 'artist' )); $router->add('/album/{id:[0-9]+}/{name}', array( 'module' => 'frontend', 'namespace' => 'AlbumOrama\Frontend\Controllers\', 'controller' => 'catalog', 'action' => 'album', )); $router->add('/tag/{name}', array( 'module' => 'frontend', 'namespace' => 'AlbumOrama\Frontend\Controllers\', 'controller' => 'catalog', 'action' => 'tag' )); $router->add('/tag/{name}/{page:[0-9]+}', array( 'module' => 'frontend', 'namespace' => 'AlbumOrama\Frontend\Controllers\', 'controller' => 'catalog', 'action' => 'tag' )); $router->add('/search(/?)', array( 'module' => 'frontend', 'namespace' => 'AlbumOrama\Frontend\Controllers\', 'controller' => 'catalog' , 'action' => 'search' )); $router->add('/popular', array( 'module' => 'frontend', 'namespace' => 'AlbumOrama\Frontend\Controllers\', 'controller' => 'catalog', 'action' => 'popular' )); $router->add('/charts', array( 'module' => 'frontend', 'namespace' => 'AlbumOrama\Frontend\Controllers\', 'controller' => 'catalog', 'action' => 'charts' )); $router->add('/about', array( 'module' => 'frontend', 'namespace' => 'AlbumOrama\Frontend\Controllers\', 'controller' => 'about', 'action' => 'index' )); /** - Backend routes */ #print_r($router); exit; return $router; ////////////// set the db params properly ////////////// public/.htacces AddDefaultCharset UTF-8 RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L] .htaccess RewriteEngine On RewriteRule ^$ public/ [L] RewriteRule (.*) public/$1 [L] Is there anything left, as I m still getting Service 'view' was not found in the dependency injection container