public function postUpdate(LifecycleEventArgs $args): void
    {
        // Get the object and make sure it is what we need.
        $object = $args->getObject();
        if (!$object instanceof PublishableInterface) {
            return;
        }

        // Get the changeset from the unit of work.
        $uow = $args->getObjectManager()->getUnitOfWork();
        $changeset = $uow->getEntityChangeset($object);

        // If the published state changed fire the published event.
        if (isset($changeset['published'])
            && false === $changeset['published'][0]
            && true === $changeset['published'][1]) {
            $event = new EntityPublishedEvent($object);
            $this->event_dispatcher->dispatch(EntityPublishedEvent::NAME, $event);
        }
    }
public function postUpdate(LifecycleEventArgs $args): void
    {
        // Get the object and make sure it is what we need.
        $object = $args->getObject();
        if (!$object instanceof PublishableInterface) {
            return;
        }

        // Get the changeset from the unit of work.
        $uow = $args->getObjectManager()->getUnitOfWork();
        $changeset = $uow->getEntityChangeset($object);

        // If the published state changed fire the published event.
        if (isset($changeset['published'])
            && false === $changeset['published'][0]
            && true === $changeset['published'][1]) {
            $event = new EntityPublishedEvent($object);
            $this->event_dispatcher->dispatch(EntityPublishedEvent::NAME, $event);
        }
    }
public function postUpdate ( LifecycleEventArgs $ args ) : void { // Get the object and make sure it is what we need. $ object = $ args -> getObject ( ) ; if ( ! $ object instanceof PublishableInterface ) { return ; } // Get the changeset from the unit of work. $ uow = $ args -> getObjectManager ( ) -> getUnitOfWork ( ) ; $ changeset = $ uow -> getEntityChangeset ( $ object ) ; // If the published state changed fire the published event. if ( isset ( $ changeset [ 'published' ] ) && false === $ changeset [ 'published' ] [ 0 ] && true === $ changeset [ 'published' ] [ 1 ] ) { $ event = new EntityPublishedEvent ( $ object ) ; $ this -> event_dispatcher -> dispatch ( EntityPublishedEvent :: NAME , $ event ) ; } }
If an object is updated and published fire published event.

@param LifecycleEventArgs $args The lifecycle arguments.

@return void
If an object is updated and published fire published event .