Specifying relationships with YAML for Doctrine -
just trying specify tables structures , models doctrine in yaml file. i'm going through documentation on page: http://www.doctrine-project.org/projects/orm/1.2/docs/manual/yaml-schema-files/en
i haven't quite got grasp on each line in relations section doing.
here's sample yaml page:
user: columns: username: type: string(255) password: type: string(255) contact_id: type: integer relations: contact: class: contact local: contact_id foreign: id foreignalias: user foreigntype: 1 type: 1
specifically, relations, in order:
contact is.. guessing name of other corresponding table pertaining relationship?
class: contact is.. exactly? name of model created yaml?
local: contact_id local key, understand this.
foreign: id field name of foreign key, understand this
foreignalias: user line doing?
foreigntype: one
type: one: guessing these 2 lines specify type of relationship, eg, one-to-one?
thanks , help.
contact is.. guessing name of other corresponding table pertaining >relationship?
nope. name of object later use when accessing contact information of user.
$user->contact->email
this can different class-name
class: contact is.. exactly? name of model created >yaml?
that class referencing. needs classname in yaml (i.e. contact)
local: contact_id local key, understand this. foreign: id field name of foreign key, understand this
foreignalias: user line doing?
this name can access user information contact object.
$contact->user->username
foreigntype: 1 type: one: guessing these 2 lines specify type of relationship, eg, >one-to-one? jepp, right here.
Comments
Post a Comment