logo
Ask your Symfony questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$12
Sluggable integrity constraint problem

I need an answer to this question on the symphony forum : http://forum.symfony-project.org/viewtopic.php?f=22&t=37411&p=124258

Regards,
Joel

Joel Gaujard | 10/24/11 at 1:04pm Edit
Tutorial: How to assign prize money

Previous versions of this question: 10/26/11 at 12:41pm

The experts have suggested, on average, a prize of $10 for this question.

(3) Possible Answers Submitted...

See a chronological view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    10/24/11
    1:13pm
    José Nahuel Cuesta Luengo says:

    Could you provide a little more details? Have you changed anything in the default logic for the Sluggable behavior?

    • 10/24/11 1:16pm

      Joel Gaujard says:

      No change made about Sluggable behavior.

    • 10/24/11 1:19pm

      José Nahuel Cuesta Luengo says:

      Have you tried adding

      unique: false
      as an option to the Sluggable behavior?

    • 10/24/11 1:25pm

      Joel Gaujard says:

      Sorry. I have to use slug as a unique data.

  • avatar
    Last edited:
    10/24/11
    1:19pm
    Luis Cordova says:

    obviously you are not supposed to play with slugs like that,

    "When i create two article object with that same title (e.g. 'sale'), i have in my DB records with sale, sale-1 slugs." The slugs are different for the objects you created, you are creating the objects with same title but not assigning the same slugs.

    reasonable

    "When i update object title to other (e.g. 'test'), everything goes fine. But when i change 'test' title to 'sale' back, i receive error:"

    obviously unreasonable, you should not manually edit slugs like that to make them collide, or you should use a proper constraint validator to avoid for such a clash, if you are trying to purposefully make it

    CODE: SELECT ALL
    SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'sale-1-lt' for key 'article_translation_sluggable_idx'

    • 10/24/11 1:23pm

      Joel Gaujard says:

      I don't modify slug by myself. Doctrine do it for me.

    • 10/24/11 1:24pm

      Luis Cordova says:

      of course but you tell it in code

      show your code

    • 10/24/11 1:27pm

      Joel Gaujard says:

      Do you want to see the code of my form ?

    • 10/28/11 9:40am

      Luis Cordova says:

      yes, you should post it to github or something, my skype is cordova_luis

    • 10/28/11 9:41am

      Luis Cordova says:

      have you tried what Benjamin said below?

  • avatar
    Last edited:
    10/26/11
    2:52pm
    Benjamin Lévêque says:

    there is a known bug when using both i18n and sluggable.

    you need to copy the file lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Template/Listener/Sluggable.php inside your own lib directory.

    the you must edit the file following that instructions http://www.doctrine-project.org/jira/browse/DC-728

This question has expired.





Current status of this question: Community pot



Please log in to add additional discourse to this page.





Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.