FrozenNode / Laravel-Administrator

An administrative interface package for Laravel
http://administrator.frozennode.com/
MIT License
1.94k stars 502 forks source link

Class itemconfig does not exist #219

Closed handijk closed 11 years ago

handijk commented 11 years ago

I'm getting this error when running my app on the testing server, on my dev environment everything works as expected. but on the testing server whenever i call the /admin page it redirects me to the default admin page (as it should) where i get this error:

ReflectionException Class itemconfig does not exist

This itemconfig class is called at line 14 in the file /administrator/src/viewComposers.php

The app is working with the exact same code on both servers.

handijk commented 11 years ago

Update: it just looks like Route filter "validate_model" is never called so that's why itemconfig is never defined. I can't really get my head around why this won't go wrong on my dev environment, but will on all other servers while the code is mirrored.

janhartigan commented 11 years ago

Hey @handijk. This is an odd one. Since your code is the same in both environments, I suspect it might be a permissions issue. Have you assigned ownership and group rights to the apache user?

handijk commented 11 years ago

Yes this indeed seemed to be a file permission problem! I set the whole directory (for testing purposes) to 777 and it's working, thanks for the help! I still don't understand it though ;), the code is running, it's just that the filter is not called.

janhartigan commented 11 years ago

I am also at a loss :/. If you ever figure it out, I'd be curious to know!

g-psantos commented 11 years ago

I'm having the same issue. Without changing any of my code, after updating all the packages with Composer the same error shows up... I recursively set the permissions on the directory to Read & Write for everyone (Mac). What can I do to help trace the cause of this? I have the non-broken composer.lock version if it helps (and the new one, of course)

stijnvdb88 commented 11 years ago

Same issue here - it was working fine until updating the package yesterday. Also tried recursively setting 777 permissions but no joy.

janhartigan commented 11 years ago

It would help to see the exact error that's being caused. Poking around in the code would also help immeasurably. I can't do much when I can't replicate the error.

stijnvdb88 commented 11 years ago

@janhartigan, finally found the cause! I spent hours trying to figure out why your validate_model filter wasn't being executed, but couldn't find anything wrong with your code - mainly because there is nothing wrong with it. I did a clean install of administrator, still same error. Then I made a clean install of Laravel with Administrator, where everything worked normally. Turns out the cause was a conflict with one of my packages installed. @guilhermepsantos, do you have rmasters/culpa in your vendor dir? (https://github.com/rmasters/culpa). If so, chuck it out and be amazed... What strikes me as odd though is that it isn't enough to just comment out the reference to the service provider - you really need to remove the whole package for administrator to work.

stijnvdb88 commented 11 years ago

Update: it might not be the culpa package itself that's causing this, but one of its dependencies. Simply removing the folder from the vendor dir doesn't do the trick, you need to run composer update for it to work. This is what composer does when I take out culpa from my composer.json:

 - Removing filp/whoops (1.0.6)
  - Installing filp/whoops (1.0.7)
    Loading from cache

  - Removing doctrine/dbal (2.3.x-dev 6a62fef)
  - Installing doctrine/dbal (dev-master 2.4.0-RC2)
    Loading from cache

  - Removing laravel/framework (v4.0.5)
  - Installing laravel/framework (4.0.x-dev 87556b2)
    Loading from cache

  - Removing rmasters/culpa (dev-master 3dd8b2f)
g-psantos commented 11 years ago

@stijnvdb88 No, I don't have Culpa installed -- it must be from one of the other packages. @janhartigan Here's a ZIP file with the full error stack, as well as my Composer files (.json and .lock): http://sdrv.ms/16Zobiz

Let me know if you figure out what it is from this; if not, I probably can manage to get you access to my application's source code

janhartigan commented 11 years ago

I think this might have something to do with packages that extend Eloquent. @guilhermepsantos are you using any package like that, and if so, which?

g-psantos commented 11 years ago

@janhartigan No, no packages extending Eloquent -- only Administrator and Mews/Useragent are installed (and removing Useragent doesn't help, I just tried it)

janhartigan commented 11 years ago

Alright well then I'm going to need you to be a little industrious for me and sleuth out the problem. The itemconfig shared instance is set in filters.php, so whatever is going on is probably happening there. Debug it a little and let me know what you find

g-psantos commented 11 years ago

It had nothing to do with the filters, but I managed to get rid of this error by using the dev-master branch of Laravel (I was using **4.0.***). I'm having other problems now though, but I'll see if I can sort those out on my own and report back if I can't.

ghost commented 11 years ago

I get the same error in the dashboard. It raises in header.blade.php#7

<a href="#" id="filter_button" class="{{App::make('itemconfig')->getType() === 'model' ? '' : 'hidden'}}"><div></div></a>
janhartigan commented 11 years ago

@pgerdsmeier thanks for bringing that up. This is a bug in the new version. I'll get that sorted out right away.

zwacky commented 10 years ago

sorry for necro-ing this issue. I did have the exact problem and could work around it by not using my $app->detectEnvironment in the bootstrap/start.php file.

andrewdworn commented 10 years ago

Thanks @zwacky, your comment helped me a lot! I also had the same exact problem: latest administrator, same files on local and testing server, but the testing server threw this ReflectionException - Class itemconfig does not exist error. Only one thing was not the same: the Environment. Strange, but I found out, that the problem is caused by the environment keyword testing. Everything else works fine, for exampletesting2. I have no idea what could possibly cause this...

juanstiza commented 9 years ago

Well yesterday I was ripping my hairs off... Thanks @andrewdworn , I was too using testing as an environment, changing it to production solved it.

ArubaBB commented 9 years ago

Thanks guys, this topic is still very needful :-)