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

        // Active unpublished objects should be published.
        if ($object->isActive() && !$object->isPublished()) {
            $object->setPublished(true);
        }
    }
public function preUpdate(LifecycleEventArgs $args): void
    {
        // Get the object and make sure it is what we need.
        $object = $args->getObject();
        if (!$object instanceof PublishableInterface) {
            return;
        }

        // Active unpublished objects should be published.
        if ($object->isActive() && !$object->isPublished()) {
            $object->setPublished(true);
        }
    }
public function preUpdate ( LifecycleEventArgs $ args ) : void { // Get the object and make sure it is what we need. $ object = $ args -> getObject ( ) ; if ( ! $ object instanceof PublishableInterface ) { return ; } // Active unpublished objects should be published. if ( $ object -> isActive ( ) && ! $ object -> isPublished ( ) ) { $ object -> setPublished ( true ) ; } }
Act before updating an object.

@param LifecycleEventArgs $args The event arguments.

@return void
Act before updating an object .