That fixed it. I actually tried that before, but would get SQL errors 
adding the foreign key. I realized Doctrine's integer default is BIGINT 
on mysql, so I changed it to integer(4) and it worked.

The fixture still gets the same error though. There are two lines that 
stand out to me in the base class that gets generated:

    $this->hasColumn('email', 'varchar', 128, array('type' => 'varchar', 
'notnull' => true, 'length' => '128'));
    $this->option('attributes', array('export' => 'all', 'validate' => 
true));

I don't really see why my fixture would be failing validation(all 
fixtures load in except the sfGuardUserProfile one), but I also don't 
really understand what validation is going on.

*Brian Racer
*
Lead Developer
JetPack Web Development, LLC
(715) 834-3349 office
br...@jetpackweb.com <mailto:br...@jetpackweb.com>


Lee Bolding wrote:
> At a guess, I'd say your foreign key reference doesn't work because  
> it's the primary key in your sf_guard_user_profile.
>
> Create an id column, and then I think it will start working (you can  
> always make user_id unique if you want only 1 profile per user).
>
> On 4 Mar 2009, at 23:56, Brian Racer wrote:
>
>   
>> I have used sfGuard before, but I would like to start taking  
>> advantage of Doctrine. I installed sfDoctrineGuard and followed the  
>> README and got a basic setup working. Next I wanted to add a custom  
>> profile. The README docs still use the Propel schema format, so I  
>> created this:
>>
>> sfGuardUserProfile:
>>   actAs: { Timestampable: ~ }
>>   tableName: sf_guard_user_profile
>>   columns:
>>     user_id:     { type: integer, primary: true }
>>     email:       { type: varchar(128), notnull: true }
>>   relations:
>>     sfGuardUser:
>>       local:  user_id
>>       foreign: id
>>       onDelete: CASCADE
>>
>> This works, but no foreign reference is setup for that table. Any  
>> ideas why that is?
>>
>> Next I created a fixture for the profile:
>>
>> sfGuardUserProfile:
>>   admin_profile:
>>     user_id: 1
>>     email: f...@bar.com
>>
>> When I run ./symfony doctrine:build-all-reload I receive the  
>> following error message:
>>
>> Validation failed in class sfGuardUserProfile
>>   1 field had validation error:
>>     * 1 validator failed on email (type)
>>
>> If I remove the email from the fixture(and set emails to allow null)  
>> a row gets inserted. If I manually try and insert those values into  
>> the database they get inserted.
>>
>> So if anyone can shed some light one why this fixture doesn't work,  
>> and why the foreign key reference doesn't get inserted I would  
>> appreciate it!
>>
>> -- 
>> Brian Racer
>> Lead Developer
>> JetPack Web Development, LLC
>> (715) 834-3349 office
>> br...@jetpackweb.com
>>
>>
>>     
>
>
> >
>   

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to