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

        // Publish active objects immediately.
        if ($object->isActive()) {
            $object->setPublished(true);
        } else {
            $object->setPublished(false);
        }
    }
public function prePersist(LifecycleEventArgs $args): void
    {
        // Get the object and make sure it is what we need.
        $object = $args->getObject();
        if (!$object instanceof PublishableInterface) {
            return;
        }

        // Publish active objects immediately.
        if ($object->isActive()) {
            $object->setPublished(true);
        } else {
            $object->setPublished(false);
        }
    }
public function prePersist ( LifecycleEventArgs $ args ) : void { // Get the object and make sure it is what we need. $ object = $ args -> getObject ( ) ; if ( ! $ object instanceof PublishableInterface ) { return ; } // Publish active objects immediately. if ( $ object -> isActive ( ) ) { $ object -> setPublished ( true ) ; } else { $ object -> setPublished ( false ) ; } }
If an object is active set published value.

@param LifecycleEventArgs $args The event arguments.

@return void
If an object is active set published value .