Take the 2-minute tour ×

I want to split the user data into two tables/objects:

  1. Technical user data (username, email, password, salt, ..)
  2. Personal user data (name, birth, address, characteristic)

The hard thing about this is now that a simple embedded object (personal user data is embedded in the tecnical user data) would have to strict dependency and two totally seperated objects would make it hard to handle permission questions.

So how can I relate the data without having dependency between the entities?

Best Regards, Bodo

share|improve this question
add comment

1 Answer

Reading your question, what comes to my mind is "Loose Interface Coupling". In this case, what you could do is: 1) Create an interface that defines public methods for personal user data, for example "PersonalDataInterface". 2) Make the entity holding personal data implement that interface. 3) In your technical data entity, instead of typehinting the entity holding personal data, typehint the interface.

This way, you will be able to pass to that entity any object implementing that interface.

I hope it helped!

share|improve this answer
Hi, thank you for the answer! The loose relation should be on persistence-layer. So direkt in Doctrine. I should have the option to fetch either private data or technical data without having the full object of both. For example if the user uploads a new file I just want to save it in the user-data entity and everthing is fine I wouldn't like having to tell the technical user entity that there is a new image linked to the user –  bodokaiser Apr 15 '12 at 7:33
add comment

Your Answer


