As requested I am running various test updates to J4.
One custom extension has the following code which I think might have been created by https://www.component-creator.com/
public function __construct(&$db)
{
JObserverMapper::addObserverClassToClass('JTableObserverContenthistory', 'GridsTablecell', array('typeAlias' => 'com_grids.cell'));
parent::__construct('#__grid_cells', 'id', $db);
}
This is resulting in
An error has occurred.
0 Class 'JObserverMapper' not found
I have checked the backwards compatibility issues page on the docs site and I dont see any mention of this.
I have checked the j3 code and I dont see any mention of it being deprecated or removed https://github.com/joomla/joomla-cms/tree/staging/libraries/joomla/observer
Labels |
Added:
?
|
a bit late to tag the code as deprecated isnt it?
Well yes and no it is removed and I personally dont expect it is comming back so we should atleast tag it correctly. But thats why i called George to give his word on that question too.
All I can I find is
https://github.com/joomla/joomla-cms/blob/staging/libraries/classmap.php#L70-73
I can't find any deprecation notes anywhere for JTableObserver - maybe I am looking in the wrong places?
Well i bet there are'nt any so it is not your foult in not finding it. That classmapper is deprecating most "J" aliases with Joomla 5.0 so i think it just was overlooked to propertly add the deprecated tag to the code.
https://github.com/joomla/joomla-cms/blob/staging/libraries/classmap.php#L70-73
Seems that got changed as a batch form 4.0 to 5.0 here: #16353
I can't even find the PR where the code was removed :( so I would have a clue what to write instead.
That might be the reasone there is no deprecation tag in 3.x:
Thanks! Actually that isn't actually a PR. That was some code by Nic in the early days of pythag which I ported across to the 4 branch here. It's a good point though, because all that needs to be written up
And it got removed and then put back in the classmap
And it got removed and then put back in the classmap
?
No I guess the classmap was merged up from 3.x where that class was namespaced.
sorry I had so many windows open I looked in the wrong version of the classmap - at least that part is correct.
joomla-x/joomla-pythagoras#17 This was the original PR from the old J4 repo (what was then pythag). I then cherry-picked this into J4. It was literally the first commit to the J4 branch in the official repo
Anything depending on custom JTable observers. They have been superseded by the Event system.
But no explanation or even hint at how to replace this in your own code :(
Still need docs per the issue you linked to Tobias linked to in #16299 (comment)
But generally speaking you can just remove that code for J4. The JTable class now throws events so as long as all the Table methods call their parent method (for example in weblinks there was a single place where they didn't - joomla-extensions/weblinks@2247d9b#diff-8fef9122b821128ac867388496eb53b4R202)
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-08-07 08:20:00 |
Closed_By | ⇒ | brianteeman | |
Labels |
Added:
?
Removed: ? |
Closed - nothing to see here
Deleting the line helped me:
JObserverMapper::addObserverClassToClass('JTableObserverContenthistory', 'GridsTablecell', array('typeAlias' => 'com_grids.cell'));
hmm the only thing i found is this:
https://docs.joomla.org/Potential_backward_compatibility_issues_in_Joomla_4#Table
I'm not sure why it hasn't be deprecated in the code too maybe @wilsonge knows more details here so we can get them tagged correctly.