Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3933600
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:37:10+00:00 2026-05-19T23:37:10+00:00

Just trying to specify some tables structures and models for Doctrine in a YAML

  • 0

Just trying to specify some tables structures and models for Doctrine in a YAML file. I’m going through the documentation on this page: http://www.doctrine-project.org/projects/orm/1.2/docs/manual/yaml-schema-files/en

I haven’t quite got a grasp on what each line in the relations section is doing.

Here’s some sample YAML from that 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: one
      type: one

Specifically, relations, in order:

Contact is.. I am guessing the name of the other corresponding table pertaining to this relationship?

class: contact is.. what exactly? The name of the model that will be created from this YAML?

local: contact_id is the local key, I understand this.

foreign: id is the field name of the foreign key, I understand this

foreignAlias: User what is this line doing?

foreignType: one
type: one: I am guessing these two lines together specify the type of relationship, eg, one-to-one?

Thanks for any and all help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T23:37:10+00:00Added an answer on May 19, 2026 at 11:37 pm

    Contact is.. I am guessing the name of the other corresponding table pertaining to this >relationship?

    Nope. It is the Name of the object you later use when accessing contact information of a user.

    $user->Contact->email

    This can be different from the Class-Name

    class: contact is.. what exactly? The name of the model that will be created from this >YAML?

    That is the class you are referencing. Needs to be the Classname in the YAML (i.e. Contact)

    local: contact_id is the local key, I understand this.
    foreign: id is the field name of the foreign key, I understand this

    foreignAlias: User what is this line doing?

    This is the name you can access the user information from a contact object.

    $contact->User->username

    foreignType: one
    type: one: I am guessing these two lines together specify the type of relationship, eg, >one-to-one?
    Jepp, you are right here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just trying to get my head around Generics by reading this enlightening article by
Im trying to code my own DSL for file manipulation, just for the sake
Just trying to get my irb sessions to actually list the current line of
Just trying to get up to speed with the SDK... So, I've created my
Just trying to get my head round Spring and figuring out how I wire
I'm just trying to time a piece of code. The pseudocode looks like: start
Developing a website and just trying to get back into the swing of (clever)
I'm just trying to get a general idea of what views are used for
I am just trying to generate the classes for linq to mysql with dbmetal
I'm just trying to do simple scripting with F#, and Math.PI seems to have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.