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

  • SEARCH
  • Home
  • 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 646933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:40:03+00:00 2026-05-13T21:40:03+00:00

I’m setting up my first symfony project, and am having trouble with the schema.

  • 0

I’m setting up my first symfony project, and am having trouble with the schema. I’m not sure if I’m going about it the right way.

I’m having a problem with two of my classes. I have Clients, which can have many Contacts, one of the contacts needs to be selected as the invoice contact. This is my schema:

NativeClient:
  actAs: { Timestampable: ~ }
  columns:
    name:                { type: string(255), notnull: true }
    address:             { type: string(255) }
    postcode:            { type: string(9) }
    tel:                 { type: string(50) }
    fax:                 { type: string(50) }
    website:             { type: string(255) }
    client_status_id:    { type: integer, notnull: true, default: 0 }
    priority:            { type: boolean, notnull: true, default: 0 }
    invoice_contact_id:  { type: integer }
    invoice_method_id:   { type: integer }
  relations:
    NativeContact:       { local: invoice_contact_id, foreign: id, foreignAlias: NativeInvoiceContacts }
    NativeClientStatus:  { local: client_status_id, foreign: id, foreignAlias: NativeContacts }
    NativeInvoiceMethod: { local: invoice_method_id, foreign: id, foreignAlias: NativeClientStatuses }


NativeContact:
  actAs: { Timestampable: ~ }
  columns:
    client_id:          { type: integer, notnull: true }
    name:               { type: string(255), notnull: true }
    position:           { type: string(255) }
    tel:                { type: string(50), notnull: true }
    mobile:             { type: string(50) }
    email:              { type: string(255) }
  relations:
    NativeClient:       { onDelete: CASCADE, local: client_id, foreign: id, foreignAlias: NativeClients } 

NativeClientStatus:
  actAs: { Timestampable: ~ }
  columns:
    name:               { type: string(255), notnull: true }

NativeInvoiceMethod:
  actAs: { Timestampable: ~ }
  columns:
    name:               { type: string(255), notnull: true }

If i remove the following line (and associated fixtures) it works, otherwise I get a segmentation fault.

NativeContact:       { local: invoice_contact_id, foreign: id, foreignAlias: NativeInvoiceContacts }

Could it be getting in a loop? Trying to reference the Client and the Contact over and over? Any help would be greatly appreciated! Thanks!

Darren

  • 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-13T21:40:03+00:00Added an answer on May 13, 2026 at 9:40 pm

    Darren, it seems like you’re defining the relationship at both ends while using conflicting criteria…

    NativeContact:       { local: invoice_contact_id, foreign: id, foreignAlias: NativeInvoiceContacts }
    

    …relationship is between “invoice_contact_id” and undeclared “id” PK in NativeContact.

     NativeClient:       { onDelete: CASCADE, local: client_id, foreign: id, foreignAlias: NativeClients } 
    

    … same relationship is between “client_id” and undeclared “id” PK in NativeClient.

    I personally only define these in one end and let Doctrine handle the rest, but it depends on what you’re trying to achieve here. If ONE client HAS MANY contacts, you could drop the second declaration and define the relationship in the clients table only and add “type: many, foreignType: one” to state that it’s a one-to-many relationship.

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

Sidebar

Related Questions

No related questions found

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.