Error when adding custom block to a page

Permalink 1 user found helpful
I have a custom block that I have built that's pretty simple. I've used it before on previous version of C5 without issues. However, when I add it to a page on Concrete 5.4.0.5, I get the following error:

Fatal error: method_exists() [<a href='function.method-exists'>function.method-exists</a>]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition &quot;RelatedLinksBlockController&quot; of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in /var/www/concrete-core/5.4.0.5/libraries/database_indexed_search.php  on line 113


Any ideas as to what might cause this? As far as I know, everything in the block looks okay. Here is the block controller if that gives any insight:

class RelatedLinksBlockController extends BlockController {
      var $pobj;
      protected $btTable = 'btRelatedLinks';
      protected $btInterfaceWidth = "600";
      protected $btInterfaceHeight = "280";
      public function getBlockTypeDescription() {
         return t("Formats a links of related links to be displayed in the right hand column on MC template sites.");
      }
      public function getBlockTypeName() {
         return t("Related Links");
      }
   }


As you can see, it's pretty simple. Any help would be greatly appreciated.

jgarcia
 
nteaviation replied on at Permalink Best Answer Reply
nteaviation
I had this same issue that seemed to "go away" when Site Cacheing was disabled. I also discovered that Version 5.3.x did not present this error. After combing the forums, I came across this:
http://www.concrete5.org/community/forums/customizing_c5/cache-prob...

I had our custom block directories incorectly named to match the camel-case class definition in our controller.php. Is your custom block folder/directory named "related_links"? Hope it helps...
jgarcia replied on at Permalink Reply
jgarcia
The camel case was it. Thanks nteaviation.
nteaviation replied on at Permalink Reply
nteaviation
Glad to help :) Andrew (http://www.concrete5.org/profile/-/4/... ) deserves all the credit
fryedesign replied on at Permalink Reply
fryedesign
I ran into a similar problem, except that I named my block superimage instead of super_image, with my class called SuperImageBlockController. So it seems the underscore must align with each case shift?

Anyway, thanks, this got me on the right track!
Mnkras replied on at Permalink Reply
Mnkras
Yes, with camel casing,
the letter at the beggining and after an underscore need to be capitalized

omg_this_is_cool ->OmgThisIsCool
puppyguitar replied on at Permalink Reply
This might be obvious, but I just wanted to point out that this error can also be caused by a block name that uses capitalized initials. For example, if you have a block named MyABCBlock and you're getting this error, try renaming the controller class to MyAbcBlock and the folder name to my_abc_block.