0

I was trying to restore a version of content I am editing.

In the construct method of my administrator/components/com_joomprosubs/tables/subscription.php script, I added this following line:

JObserverMapper::addObserverClassToClass('JTableObserverContenthistory',
'JoomprosubsTableSubscription', array('typeAlias' => 'com_joomprosubs.subscription'));

This is based on what I have read in this link: https://docs.joomla.org/Using_Content_History_in_your_Component

However, when I try to restore a version, an error is displayed:

Error restoring item version from history.

The error is being returned due to the blank value of typeAlias. I don't know where I got it wrong. From the code that I added above, I have included the typeAlias with its corresponding value.

Has anybody tried adding versioning in their custom component?

2

For now, I temporarily overridden the loadHistory function from the Base Class.

from there, i passed the alias as 'com_joomprosubs.subscription'. The restoring of version history is now working.

Is there a disadvantage in my resolution?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.