I have a component on two websites.
When an user insert, update or delete an item in the first website, the same action must be performed on the second website. I made that using the postSaveHook()
method: when an action is performed in the first site, I connect to the database of the second site and replicate the action.
I need to do the same thing when an user changes the items' state: if he/she unpublishes two items, for example, the items must be unpublished in the second site. I tried to change the setState()
method to do that, but inside this method I couldn't get any referente to the items changed.
Does anybody know another solution or how to do that with setState()
?
P.S. Sorry about my English.
Finally I found the solution: override the method public function publish(&$pks, $value = 1)
of the class JModelAdmin
. In this method I have all the primary keys of the items changed. Then I was able to get their states and update the items on the second site.