Controller naming and the Block::getInstance() Fatal error..
Permalink 3 users found helpful
Hi,
I stumbled upon a strange error (strange for me at least :D) while trying to build a block that used caching and I thought this might interest some of you having similar problems. I got a block.getInstance() fatal error, when the sites cacheing feature was enabled. Meaning, that once I cleared the cache, the first load time went ok but the second load time ended up with the Block::getInstance() fatal error.
The reason for my Fatal error was a wrongly named Controller class. However, I think it's odd that the problem occurs only when you enable caching.
My class name was: MatCarGalleryBlockController and it was in a folder called MatCarGallery.
My solution:
- Change the folder name to matcar_gallery
- Change the class name to MatcarGalleryBlockController.
The problem seems to be in the interpretation of the MatCarGallery name. It can mean either a mat_car_gallery or MatCarGallery named folder, however, this problem occurs only when caching is switched on.
So, conclusion (no new insights):
- It's safer to use low-caps letters in block folder names.
I stumbled upon a strange error (strange for me at least :D) while trying to build a block that used caching and I thought this might interest some of you having similar problems. I got a block.getInstance() fatal error, when the sites cacheing feature was enabled. Meaning, that once I cleared the cache, the first load time went ok but the second load time ended up with the Block::getInstance() fatal error.
The reason for my Fatal error was a wrongly named Controller class. However, I think it's odd that the problem occurs only when you enable caching.
My class name was: MatCarGalleryBlockController and it was in a folder called MatCarGallery.
My solution:
- Change the folder name to matcar_gallery
- Change the class name to MatcarGalleryBlockController.
The problem seems to be in the interpretation of the MatCarGallery name. It can mean either a mat_car_gallery or MatCarGallery named folder, however, this problem occurs only when caching is switched on.
So, conclusion (no new insights):
- It's safer to use low-caps letters in block folder names.
I had a similar error after un-installing Sortable FancyBox Gallery. Every time I clicked on "Back to Website" I would get that error. When you mentioned caching in your post it gave me an idea. I just cleared my cache and the error was gone.
Thanks
Brett