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

        // Execute published event after the object is persisted.
        if ($object->isPublished()) {
            $event = new EntityPublishedEvent($object);
            $this->event_dispatcher->dispatch(EntityPublishedEvent::NAME, $event);
        }
    }
public function postPersist(LifecycleEventArgs $args): void
    {
        // Get the object and make sure it is what we need.
        $object = $args->getObject();
        if (!$object instanceof PublishableInterface) {
            return;
        }

        // Execute published event after the object is persisted.
        if ($object->isPublished()) {
            $event = new EntityPublishedEvent($object);
            $this->event_dispatcher->dispatch(EntityPublishedEvent::NAME, $event);
        }
    }
public function postPersist ( LifecycleEventArgs $ args ) : void { // Get the object and make sure it is what we need. $ object = $ args -> getObject ( ) ; if ( ! $ object instanceof PublishableInterface ) { return ; } // Execute published event after the object is persisted. if ( $ object -> isPublished ( ) ) { $ event = new EntityPublishedEvent ( $ object ) ; $ this -> event_dispatcher -> dispatch ( EntityPublishedEvent :: NAME , $ event ) ; } }
If an object is added as published fire published event.

@param LifecycleEventArgs $args The lifecycle arguments.

@return void
If an object is added as published fire published event .