Login | Register
My pages Projects Community openCollabNet

Discussions > users > Unique Column

propel
Discussion topic

Back to topic list

Unique Column

Reply

Author Zanier Cristian <cristian dot zanier at gmail dot com>
Full name Zanier Cristian <cristian dot zanier at gmail dot com>
Date 2007-06-27 08:22:38 PDT
Message Hi
I have a table with 2 columns first a id primary key, and second name index
interest_id integer PK
interest_name varchar (20) index
When i wanna save a name which was save before, i had an execption
There's a way to config propel to validate if the column name, on and
insert, exist on the table, and so get the id for these name.I don't
know if propel cant understand the unique column, and if i wanna insert
some value to the table, propel first have to check if this value
doesn't exist, and if exist take the value in the table
The rule is a solution that i found, but i answer if there's another way
Thanks
CZ
The schema.xml
 <table name="interests" idMethod="native">
    <column name="interest_id" type="INTEGER" required="true"
primaryKey="true" autoIncrement="true"/>
    <column name="interest_name" type="VARCHAR" size="32" required="true" />
    <unique name="unique_interest_name">
       <unique-column name="interest_name" />
    </unique>
    <index>
     <index-column name="interest_name" />
    </index>
    <validator column="interest_name">
       <rule
         name="unique"
         message="Interest Name already exists !" />
    </validator>
  </table>

« Previous message in topic | 1 of 5 | Next message in topic »

Messages

Show all messages in topic

Unique Column Zanier Cristian <cristian dot zanier at gmail dot com> Zanier Cristian <cristian dot zanier at gmail dot com> 2007-06-27 08:22:38 PDT
     Fatal error: Cannot redeclare... Anthony Smith <anthony dot smith at fedex dot com> Anthony Smith <anthony dot smith at fedex dot com> 2007-06-27 11:32:19 PDT
         Re: [propel] Fatal error: Cannot redeclare... Adam Albrechtas <adam dot albrechtas at experiencepoint dot com> Adam Albrechtas <adam dot albrechtas at experiencepoint dot com> 2007-06-27 11:59:46 PDT
             RE: [propel] Fatal error: Cannot redeclare... Anthony Smith <anthony dot smith at fedex dot com> Anthony Smith <anthony dot smith at fedex dot com> 2007-06-27 11:55:39 PDT
     Re: [propel] Unique Column Cameron Brunner <cameron dot brunner at gmail dot com> Cameron Brunner <cameron dot brunner at gmail dot com> 2007-06-27 13:42:07 PDT
Messages per page: