[symfony-users] Re: Foreign-key to self in schema?

2009-06-16 Thread E_lexy

Indeed Symfony permits i, but I have had trouble getting fixtures to
load on tables with foreign keys to itself.
It comes down to a chicken and egg situation.

For instance:
user:
  id: ~
  created_by_user_id: { type: integer, required: true, foreignTable:
user, foreignReference: id }

will work but when you want to dump the test data and then load it
again, it will fail because the referenced user does not exist.

On Jun 15, 7:38 pm, Dheeraj Kumar Aggarwal dheerajcom...@gmail.com
wrote:
 hi

 yes you can self referencing tables in schema.



 On Mon, Jun 15, 2009 at 10:36 PM, Eno symb...@gmail.com wrote:

  Is it not possible to have a field reference another field as a
  foreign key? i.e.

   category:
     id:                ~
     parent_id:         { type: integer, foreignTable: category,
  foreignReference: id, required: true }
     title:             { type: varchar(255), required: true, default:
  null }
     websafe_title:     { type: varchar(255), required: true, default:
  null }

  --

 --
 Regards,
 Dheeraj

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[symfony-users] Re: Foreign-key to self in schema?

2009-06-15 Thread Dheeraj Kumar Aggarwal
hi

yes you can self referencing tables in schema.
On Mon, Jun 15, 2009 at 10:36 PM, Eno symb...@gmail.com wrote:


 Is it not possible to have a field reference another field as a
 foreign key? i.e.


  category:
id:~
parent_id: { type: integer, foreignTable: category,
 foreignReference: id, required: true }
title: { type: varchar(255), required: true, default:
 null }
websafe_title: { type: varchar(255), required: true, default:
 null }


 --

 



-- 
Regards,
Dheeraj

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---