Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doctrine extensions slug handlers #337

Open
mcbuckets opened this issue Sep 21, 2016 · 0 comments
Open

Doctrine extensions slug handlers #337

mcbuckets opened this issue Sep 21, 2016 · 0 comments

Comments

@mcbuckets
Copy link

mcbuckets commented Sep 21, 2016

I'm trying to setup slugs for my entity that contains two many to one relationships. Both of these relations are on same entity because different user types are presented with generic user class. I differentiate them by role or type field.

On owning BookingRequest side i have:

<field name="slug" column="slug" type="string" nullable="false">
      <gedmo:slug updatable="true" fields="slug, slug" unique="true">
          <gedmo:handler class="Gedmo\Sluggable\Handler\RelativeSlugHandler">
              <gedmo:handler-option name="relationField" value="artist"/>
              <gedmo:handler-option name="relationFieldSlug" value="slug"/>
              <gedmo:handler-option name="separator" value="-"/>
          </gedmo:handler>
          <gedmo:handler class="Gedmo\Sluggable\Handler\RelativeSlugHandler">
              <gedmo:handler-option name="relationField" value="gallery"/>
              <gedmo:handler-option name="relationFieldSlug" value="slug"/>
              <gedmo:handler-option name="separator" value="-"/>
          </gedmo:handler>
      </gedmo:slug>
</field>

In my user entity(artist, gallery) i have:

<field name="slug" column="slug" type="string" nullable="false">
      <gedmo:slug updatable="true" fields="slug" unique="true">
          <gedmo:handler class="Gedmo\Sluggable\Handler\InversedRelativeSlugHandler">
              <gedmo:handler-option name="relationClass" value="App\BookingBundle\Entity\BookingRequest"/>
              <gedmo:handler-option name="mappedBy" value="artist"/>
              <gedmo:handler-option name="inverseSlugField" value="slug"/>
          </gedmo:handler>
          <gedmo:handler class="Gedmo\Sluggable\Handler\InversedRelativeSlugHandler">
              <gedmo:handler-option name="relationClass" value="App\BookingBundle\Entity\BookingRequest"/>
              <gedmo:handler-option name="mappedBy" value="gallery"/>
              <gedmo:handler-option name="inverseSlugField" value="slug"/>
          </gedmo:handler>
      </gedmo:slug>
</field>

I would like to set my BookingRequest slug as combination of artist and gallery slugs but on save i get slugs like -1, -2, -3 and so on.
What am i doing wrong and is this possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant