Google Groups Home
Help | Sign in
Sluggable and inheritance
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Nicolas  
View profile
 More options 1 Jul, 08:52
From: Nicolas <nico...@bonamy.fr>
Date: Tue, 1 Jul 2008 00:52:15 -0700 (PDT)
Local: Tues 1 Jul 2008 08:52
Subject: Sluggable and inheritance
Hello,

I am trying to setup a schema like:

Base:
  actAs:
    Sluggable:
      fields: [name]
  columns:
    name:
      type: string(512)
      notnull: true

Child1:
  inheritance:
    extends: Base
    type: column_aggregation
    keyField: type
    keyValue: 1

Child2:
  inheritance:
    extends: Base
    type: column_aggregation
    keyField: type
    keyValue: 2

The problem is that Sluggable does not seem to work correctly in that
case. If I add two Child1 objects with the same name then the slug is
different (second one is postfixed with "-1") and everything is OK. If
I add a Child1 and a Child2 object with the same name then the slugs
are equal and the insert fails with "Integrity constraint violation:
1062 Duplicate entry 'blah blah' for key 2".

Anyone has a hint on how to get around this?

Thanks,


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jonathan Wage  
View profile
 More options 1 Jul, 22:25
From: "Jonathan Wage" <jonw...@gmail.com>
Date: Tue, 1 Jul 2008 16:25:44 -0500
Local: Tues 1 Jul 2008 22:25
Subject: Re: [doctrine-user] Sluggable and inheritance

---
Base:
 actAs:
   Sluggable:
     fields: [name]
     uniqueBy: [name, type]
 columns:
   name:
     type: string(255)
     notnull: true

Child1:
 inheritance:
   extends: Base
   type: column_aggregation
   keyField: type
   keyValue: 1

Child2:
 inheritance:
   extends: Base
   type: column_aggregation
   keyField: type
   keyValue: 2

This should work for you. By default a unique index is added to the
sluggable column but since you're using column aggregation we need to make
the index on the slug and type column.

- Jon

--
Jonathan Wage
http://www.jwage.com
http://www.centresource.com

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google