src/Admin/Traits/PreEvents.php
protected function prePersistOrUpdate($object, $method)
    {
        $analyzer = new ClassAnalyzer();
        foreach ($analyzer->getTraits($this) as $traitname) {
            $rc = new \ReflectionClass($traitname);
            if (method_exists($this, $exec = $method . $rc->getShortName())) {
                $this->$exec($object);
            } // executes $this->prePersistMyTrait() or $this->preUpdateMyTrait() method
        }

        return $this;
    }
protected function prePersistOrUpdate($object, $method)
    {
        $analyzer = new ClassAnalyzer();
        foreach ($analyzer->getTraits($this) as $traitname) {
            $rc = new \ReflectionClass($traitname);
            if (method_exists($this, $exec = $method . $rc->getShortName())) {
                $this->$exec($object);
            } // executes $this->prePersistMyTrait() or $this->preUpdateMyTrait() method
        }

        return $this;
    }
protected function prePersistOrUpdate ( $ object , $ method ) { $ analyzer = new ClassAnalyzer ( ) ; foreach ( $ analyzer -> getTraits ( $ this ) as $ traitname ) { $ rc = new \ ReflectionClass ( $ traitname ) ; if ( method_exists ( $ this , $ exec = $ method . $ rc -> getShortName ( ) ) ) { $ this -> $ exec ( $ object ) ; } // executes $this->prePersistMyTrait() or $this->preUpdateMyTrait() method } return $ this ; }
function prePersistOrUpdate.

Searches in every trait (as if they were kind of Doctrine Behaviors) some logical to be
executed during the self::prePersist() or self::preUpdate() calls
The logical is stored in the self::prePersist{TraitName}() method

@param object $object (Entity)
@param string $method (the current called method, eg. 'preUpdate' or 'prePersist')

@return CoreAdmin $this
function prePersistOrUpdate .