public function generateSlugSegmentationAndPath()
    {
        // Set slug for this Account.  The reason we do this here is that
        // the slug listener hasn't been called yet
        $this->setSlug(\Gedmo\Sluggable\Util\Urlizer::urlize($this->name));

        if ($this->getParent()) {
            $account = $this;

            $pathSegments = array($account->getSlug());
            $nameSegments = array($account->getName());

            while ($account->getParent()) {
                $account        = $account->getParent();

                // Don't include root
                if ($account->getParent()) {
                    $pathSegments[] = $account->getSlug();
                    $nameSegments[] = $account->getName();
                }
            }

            $this->setPath(implode('/', array_reverse($pathSegments)));
            $this->setSegmentation(implode(':', array_reverse($nameSegments)));
        } else {
            $this->setPath('/');
            $this->setSegmentation(':');
        }
    }
public function generateSlugSegmentationAndPath()
    {
        // Set slug for this Account.  The reason we do this here is that
        // the slug listener hasn't been called yet
        $this->setSlug(\Gedmo\Sluggable\Util\Urlizer::urlize($this->name));

        if ($this->getParent()) {
            $account = $this;

            $pathSegments = array($account->getSlug());
            $nameSegments = array($account->getName());

            while ($account->getParent()) {
                $account        = $account->getParent();

                // Don't include root
                if ($account->getParent()) {
                    $pathSegments[] = $account->getSlug();
                    $nameSegments[] = $account->getName();
                }
            }

            $this->setPath(implode('/', array_reverse($pathSegments)));
            $this->setSegmentation(implode(':', array_reverse($nameSegments)));
        } else {
            $this->setPath('/');
            $this->setSegmentation(':');
        }
    }
public function generateSlugSegmentationAndPath ( ) { // Set slug for this Account.  The reason we do this here is that // the slug listener hasn't been called yet $ this -> setSlug ( \ Gedmo \ Sluggable \ Util \ Urlizer :: urlize ( $ this -> name ) ) ; if ( $ this -> getParent ( ) ) { $ account = $ this ; $ pathSegments = array ( $ account -> getSlug ( ) ) ; $ nameSegments = array ( $ account -> getName ( ) ) ; while ( $ account -> getParent ( ) ) { $ account = $ account -> getParent ( ) ; // Don't include root if ( $ account -> getParent ( ) ) { $ pathSegments [ ] = $ account -> getSlug ( ) ; $ nameSegments [ ] = $ account -> getName ( ) ; } } $ this -> setPath ( implode ( '/' , array_reverse ( $ pathSegments ) ) ) ; $ this -> setSegmentation ( implode ( ':' , array_reverse ( $ nameSegments ) ) ) ; } else { $ this -> setPath ( '/' ) ; $ this -> setSegmentation ( ':' ) ; } }
Generate slug, segmentation and path

@author Tom Haskins-Vaughan <tom@tomhv.uk>
@since  0.8.0

@ORM\PrePersist
@ORM\PreUpdate
Generate slug segmentation and path