php - working with associations doctrine -


how can information form associating doctrine. here example ----

"entityuser" join "entityapartment".

many "user" can stay in same "apartment".

now user have unique id.

all "apartment" values been set dynamically, apartmentid can set many user.

so if want apartment name "entityapartment" how can information, because in "entityapartment"** there id, name, value , etc. how can associations value.

if understand correctly, think want create manytoone relashionship between 2 entities. once created, not have think foreign keys, managed doctrine. can use property other. example :

$user = new user(); $apartment = new apartement(); $apartment->setaddress('12 xxx street'); $user->setapartement($apartment); 

and can access user's appartment :

// displays '12 xxx street' $user->getapartment()->getaddress(); 

hope helps.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -