与协会学说合作

How can i get information form associating doctrine. Here is an example ----

"EntityUser" is JOIN to "EntityApartment".

Many "User" can stay in the same "Apartment".

Now all user have unique id.

All "Apartment" values is been set dynamically, so ApartmentId can be set with many user.

So now if i want to get the Apartment name from "EntityApartment" how can i get that information, because in the "EntityApartment"** there is id, name, value and etc. So how can i get the associations value.

If I understand you correctly, I think you want to create a ManyToOne relashionship between your two entities. Once it is created, you do not have to think about foreign keys, as they are managed by Doctrine. You can simply use your property like you would do with any other. For example :

$user = new User();
$apartment = new Apartement();
$apartment->setAddress('12 xxx street');
$user->setApartement($apartment);

And you can access your user's appartment like this :

// Displays '12 xxx street'
$user->getApartment()->getAddress();

Hope this helps.