public function generateSlug()
    {
        if ( $this->getRegenerateSlugOnUpdate() || empty( $this->slug ) ) {
            $fields = $this->getSluggableFields();
            $values = [];

            foreach ($fields as $field) {
                if (property_exists($this, $field)) {
                    $val = $this->{$field};
                } else {
                    $methodName = 'get' . ucfirst($field);
                    if (method_exists($this, $methodName)) {
                        $val = $this->{$methodName}();
                    } else {
                        $val = null;
                    }
                }

                $values[] = $val;
            }

            $this->slug = $this->generateSlugValue($values);
        }
    }
public function generateSlug()
    {
        if ( $this->getRegenerateSlugOnUpdate() || empty( $this->slug ) ) {
            $fields = $this->getSluggableFields();
            $values = [];

            foreach ($fields as $field) {
                if (property_exists($this, $field)) {
                    $val = $this->{$field};
                } else {
                    $methodName = 'get' . ucfirst($field);
                    if (method_exists($this, $methodName)) {
                        $val = $this->{$methodName}();
                    } else {
                        $val = null;
                    }
                }

                $values[] = $val;
            }

            $this->slug = $this->generateSlugValue($values);
        }
    }
public function generateSlug ( ) { if ( $ this -> getRegenerateSlugOnUpdate ( ) || empty ( $ this -> slug ) ) { $ fields = $ this -> getSluggableFields ( ) ; $ values = [ ] ; foreach ( $ fields as $ field ) { if ( property_exists ( $ this , $ field ) ) { $ val = $ this -> { $ field } ; } else { $ methodName = 'get' . ucfirst ( $ field ) ; if ( method_exists ( $ this , $ methodName ) ) { $ val = $ this -> { $ methodName } ( ) ; } else { $ val = null ; } } $ values [ ] = $ val ; } $ this -> slug = $ this -> generateSlugValue ( $ values ) ; } }
Generates and sets the entity's slug. Called prePersist and preUpdate
Generates and sets the entity s slug . Called prePersist and preUpdate