protected function beforeSave(EntityInterface $entity): EntityInterface
    {
        $argv = compact('entity');
        $argv = $this->getEventManager()->prepareArgs($argv);

        $this->getEventManager()->trigger("{$this->event_prefix}_save_before", $this, $argv);
        if ($this->entity_event_prefix) {
            $this->getEventManager()->trigger("{$this->entity_event_prefix}_save_before", $this, $argv);
        }

        return $argv['entity'];
    }
protected function beforeSave(EntityInterface $entity): EntityInterface
    {
        $argv = compact('entity');
        $argv = $this->getEventManager()->prepareArgs($argv);

        $this->getEventManager()->trigger("{$this->event_prefix}_save_before", $this, $argv);
        if ($this->entity_event_prefix) {
            $this->getEventManager()->trigger("{$this->entity_event_prefix}_save_before", $this, $argv);
        }

        return $argv['entity'];
    }
protected function beforeSave ( EntityInterface $ entity ) : EntityInterface { $ argv = compact ( 'entity' ) ; $ argv = $ this -> getEventManager ( ) -> prepareArgs ( $ argv ) ; $ this -> getEventManager ( ) -> trigger ( "{$this->event_prefix}_save_before" , $ this , $ argv ) ; if ( $ this -> entity_event_prefix ) { $ this -> getEventManager ( ) -> trigger ( "{$this->entity_event_prefix}_save_before" , $ this , $ argv ) ; } return $ argv [ 'entity' ] ; }
Events to fire before an Entity is saved

@param EntityInterface $entity
@return void
Events to fire before an Entity is saved