• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Datamapper and ID field

#4
[eluser]WanWizard[/eluser]
[quote author="gte451f" date="1335900102"]It may not have been clear from the example, but the Employee->user_id is taken from User->id. It is intended as a unique Foreign Key. Therefore, the employee->user_id can and would be unique under such an arrangement.[/quote]
It was very clear. Still, EVERY Datamapper table needs a primary key, and it HAS to be called 'id'.

[quote author="gte451f" date="1335900102"][quote author="WanWizard" date="1335508827"]
You may think that you have defined a one-to-one (which by the way isn't a relationship that exists in Datamapper),
[/quote]
I'm confused...here is a One-To-One in the user docs.
Perhaps we are talking about different things?[/quote]
What I mean is that Datamapper currently has no logic to enforce a one-to-one, it doesn't delete a relation when you set a second one. So technically a one-to-one is the same as a one-to-many.

[quote author="gte451f" date="1335900102"]
Rather, I'd like to drop the requirement that every datamaper model require a table to have a Auto Increment PK called ID. In some examples the child table doesn't need this type of field since it takes its parent table Primary Key.

Specifically, could we optionally drop the requirement that the PK name = "Id" and could be drop the Auto Increment part as well?[/quote]
That would mean rewriting large parts of Datamapper, since everything is done on this column, and it's hardcoded.

This will be addressed in 2.0, for which no release date exists at this moment (I wait for CI 3.0 to be released, currently there are to many changes going on in the core).


Messages In This Thread
Datamapper and ID field - by El Forum - 04-26-2012, 04:02 PM
Datamapper and ID field - by El Forum - 04-26-2012, 11:40 PM
Datamapper and ID field - by El Forum - 05-01-2012, 12:21 PM
Datamapper and ID field - by El Forum - 05-01-2012, 11:43 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.