public function getUniqueAlias($entity,
        string $titleProperty = 'title',
        string $titleValue = null,
        string $aliasColumn = 'seoTitle'): string
    {
        $alias = Strings::webalize($titleValue ?? $entity->{$titleProperty});
        $id = $entity->id ?? null;
        while (!$this->seoTitleIsUnique($id, $alias, $aliasColumn)) {
            if (preg_match('/.*-\d{1,3}$/', $alias)) {
                $dashPosition = strrpos($alias, '-');
                $base = substr($alias, 0, $dashPosition);
                $number = substr($alias, $dashPosition + 1);
                $number++;
                $alias = "$base-$number";
            } else {
                $alias = $alias . '-1';
            }
        }
        return $alias;
    }
public function getUniqueAlias($entity,
        string $titleProperty = 'title',
        string $titleValue = null,
        string $aliasColumn = 'seoTitle'): string
    {
        $alias = Strings::webalize($titleValue ?? $entity->{$titleProperty});
        $id = $entity->id ?? null;
        while (!$this->seoTitleIsUnique($id, $alias, $aliasColumn)) {
            if (preg_match('/.*-\d{1,3}$/', $alias)) {
                $dashPosition = strrpos($alias, '-');
                $base = substr($alias, 0, $dashPosition);
                $number = substr($alias, $dashPosition + 1);
                $number++;
                $alias = "$base-$number";
            } else {
                $alias = $alias . '-1';
            }
        }
        return $alias;
    }
public function getUniqueAlias ( $ entity , string $ titleProperty = 'title' , string $ titleValue = null , string $ aliasColumn = 'seoTitle' ) : string { $ alias = Strings :: webalize ( $ titleValue ?? $ entity -> { $ titleProperty } ) ; $ id = $ entity -> id ?? null ; while ( ! $ this -> seoTitleIsUnique ( $ id , $ alias , $ aliasColumn ) ) { if ( preg_match ( '/.*-\d{1,3}$/' , $ alias ) ) { $ dashPosition = strrpos ( $ alias , '-' ) ; $ base = substr ( $ alias , 0 , $ dashPosition ) ; $ number = substr ( $ alias , $ dashPosition + 1 ) ; $ number ++ ; $ alias = "$base-$number" ; } else { $ alias = $ alias . '-1' ; } } return $ alias ; }
Returns unique seo alias for entity
@param entity $entity
@param string $titleProperty
@param string $titleValue
@param string $aliasColumn
@return string entity seo title
Returns unique seo alias for entity