Skip to main content
spelling in title
Link
Cœur
  • 39k
  • 25
  • 207
  • 282

Can you get a foreign key from an object in Doctine2Doctrine2 without loading that object?

Source Link
pogo
  • 2.3k
  • 2
  • 25
  • 36

Can you get a foreign key from an object in Doctine2 without loading that object?

I'm working on an events site and have a one to many relationship between a production and its performances, when I have a performance object if I need its production id at the moment I have to do

$productionId = $performance->getProduction()->getId(); 

In cases when I literally just need the production id it seems like a waste to send off another database query to get a value that's already in the object somewhere. Is there a way round this?