Skip to content
New issue

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

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

Already on GitHub? # to your account

n:m table data population throw integrity constraint violation #31

Open
lionelbzv opened this issue Mar 26, 2014 · 1 comment
Open

n:m table data population throw integrity constraint violation #31

lionelbzv opened this issue Mar 26, 2014 · 1 comment

Comments

@lionelbzv
Copy link

Env = SF2.3 / Propel 1.6.9

schema.xml:

    <table name="follow" isCrossRef="true">
        <behavior name="timestampable" />
        <column name="user_id" type="integer" required="true" primaryKey="true" />
        <column name="debate_id" type="integer" required="true" primaryKey="true" />
        <foreign-key foreignTable="user" onDelete="CASCADE" onUpdate="CASCADE">
            <reference local="user_id" foreign="id" />
        </foreign-key>
        <foreign-key foreignTable="debate" onDelete="CASCADE" onUpdate="CASCADE">
            <reference local="debate_id" foreign="id" />
        </foreign-key>
    </table>

I've populated the 2 foreign tables without problem and want some random datas for the crossRef table:

        Acme\Model\Follow:
            number:                     150

The faker:populate try to populate this table with _sometimes_ the 2 same lines and for sure it throws the exception:

[PropelException]                                                                                                                                                     
  Unable to execute INSERT statement [INSERT INTO `follow` (`user_id`, `debate_id`, `created_at`, `updated_at`) VALUES (:p0, :p1, :p2, :p3)] [wrapped: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '73-136' for key 'PRIMARY']  

I've got the same problem with an "equal nest" table/relation.

Thanks.

@c33s
Copy link

c33s commented Jun 5, 2014

+1

Belgiets added a commit to Belgiets/symfony_tt that referenced this issue Feb 28, 2016
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants