Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 1925

Joomla! 5.x Coding • Re: Autoload_psr4 or registration problem? My Joomla Component works fine with wamp64 localhost but fails on live site

$
0
0
Update: In case others have a similar problem I am recording here my analysis and solution.

The "error 0 - Call to a member function get() on null" was occurring when a line of code in my default template was trying to fetch a state value for the Joomla built-in sorting capability (e.g. list order and direction). I deduced that although in wamp64 Joomla happily loads the default model (which shows in wamp64 as "hcoconcertsmodel" in the registry with a value of "HCOConcertsModel" as the name), on the live site in linux it did not. I tried very hard indeed to find where I had specified the default model as all lower case, but could not find it. I suspected that on linux it might also not have loaded the data for my model too.
My solution was explictly to call an instance of the model in my view HtmlView file and again in the tmpl/default file, (using "$model = $app->bootComponent('com_hcoconcerts')->getMVCFactory()->createModel('HCOConcertsResults', 'Site');" and use $model->get and setState('xxxx') instead of $this->get and set (which was causing Joomla to call the model function by constructing what it thought was the model name). I now have the linux site working as perfectly with my component as it had in wamp64 over a week ago.

Statistics: Posted by DerekE — Thu May 23, 2024 5:32 pm



Viewing all articles
Browse latest Browse all 1925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>