LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 05-08-2012, 12:00 PM   #1
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Rep: Reputation: 83
doctrine / PHP - how to handle a table that has no PK?


Hi!

I'm using doctrine to use an already built DB so that I don't have to go down to the DB level and write as little code as possible.

Here's this table that has no PK. It maps other 2 entities from the project (users to departments, for example) so no PK is really needed on this table.

Of course, I hit the "every entity needs a PK" doctrine requirement and so I'm stuck. I guess I could use a two-field PK but how do I feed it into doctrine?

Thanks in advance.
 
Old 05-08-2012, 12:38 PM   #2
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
Is it possible to create virtual columns in doctrine? If it is, is it possible to fool doctrine into using them as the PK?
 
Old 05-08-2012, 03:44 PM   #3
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,455

Rep: Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172
Make one. You'll be glad you did.

If you need to refer to "a particular column," then you truly do need a key to refer to it. There are plenty of ways to add a unique PK to a table that does not now have one.

I understand perfectly that "you'd rather not." And, I am also-perfectly saying to you now, "oh yes, you do."
 
Old 05-08-2012, 03:59 PM   #4
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
Perhaps technically it makes sense... but if it gets out of my hands (and it does) I have to find a workaround for it.
 
  


Reply

Tags
doctrine, entity, multi field primary key, php, primary key


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] doctrine / postgres - timestamp without timezone eantoranz Programming 2 05-07-2012 05:43 PM
Tuning Apache to handle PHP with NginX on the frontend nyheat Linux - Server 2 07-18-2010 01:21 PM
PHP - How to properly handle GET method input in a MySQL query? win32sux Programming 16 03-16-2008 01:20 PM
Iceweasel Can't Handle PHP Files? carlosinfl Debian 3 02-10-2008 09:28 PM
LXer: Google, the Associated Press, and the Fair Use Doctrine LXer Syndicated Linux News 0 09-20-2006 05:21 PM


All times are GMT -5. The time now is 03:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration