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 8337965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:26:59+00:00 2026-06-09T04:26:59+00:00

I am trying to create a symfony2 application. The main idea behind the project

  • 0

I am trying to create a symfony2 application. The main idea behind the project is that there is an event which many guests are invited to and they are categorized. I have created a relational model for all the entities.

There are 4 tables:

  1. Guests – who is invited
  2. Category – what category/categories he belongs to ?
  3. Event – the event which they are invited to
  4. Guest_Event (attendance)

I have concluded to the following schemas:

xxxxBundle\Entity\Guest:
  type: entity
  table: guest
  id:
    id:
      type: integer
      generator: { strategy: AUTO }
  fields:
    name:
      type: string
      length: 100
      nullable: false
    surname:
      type: string
      length: 100
      nullable: false   
    email:
      type: string
      length: 255
      nullable: true
    address:
      type: string
      length: 255
      nullable: true
    phone:
      type: string
      length: 10
    description:
      type: text
    created_at:
      type: datetime
    updated_at:
      type: datetime
      nullable: true   
    token:
      type: string
      length: 255
      unique: true
    is_activated:
      type: boolean
      nullable: true
  manyToOne:
    category:
      targetEntity: Category
      inversedBy: guest
      joinColumn:
        name: category_id
        referencedColumnName: id
  lifecycleCallbacks:
    prePersist: [ setCreatedAtValue ]
    preUpdate: [ setUpdatedAtValue ]

Category

xxxxBundle\Entity\Category:
  type: entity
  table: category
  id:
    id:
      type: integer
      generator: { strategy: AUTO }
  fields:
    name:
      type: string
      length: 255
      unique: true
  oneToMany:
    guests:
      targetEntity: Guest
      mappedBy: category
    attend:
      targetEntity: Attendance
      mappedBy: category

Event

xxxxxBundle\Entity\Event:
  type: entity
  table: event
  id:
    id:
      type: integer
      generator: { strategy: AUTO }
  fields:
    name:
      type: string
      length: 100
      nullable: false
    location:
      type: string
      length: 255
      nullable: true
    scheduled_at:
      type: datetime
  manyToMany:
    category:
      targetEntity: guest
      inversedBy: event
      joinColumn:
        name: event_id
        referencedColumnName: id
  • A guest might belong to multiple categories (manyToOne)
  • A category will have many guests (manyToOne)
  • A guest might attend many events (manyToOne)
  • An event might have many attendants (manyToMany?)
  • the attendance table (guest_event) should be a join table ?

I am a little bit confused about ORM and doctrine coding. Creating the tables via SQL code or phpmyadmin seems much easier to me but I want to go the hard way ! The documentation seems confusing because each tutorial suggests different things and the doctrine ORM section in the symfony2 book doesn’t have a complete example but pieces of code..

How can I correct my tables to include all the specifications ?

  • 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-06-09T04:27:01+00:00Added an answer on June 9, 2026 at 4:27 am

    My two cents:

    A guest might belong to multiple categories

    So many guests can belong to many categories, so it’s many to many guest side. Assuming the owning side is Guest:

    xxxxBundle\Entity\Guest:
      manyToMany:
        categories:
          targetEntity: Category
          inversedBy: guests
          joinTable:
             name: guests_categories
    

    A category will have many guests (manyToOne)

    If category will have many guests, why is’s many to one? Many categories can be assigned to many guest:

    xxxxBundle\Entity\Category:
      manyToMany:
        guests:
          targetEntity: Guest
          mappedBy: categories
    

    If i understand you correctly, a categoy may exist even without a guest, and vice-versa a guest may exist even without a category.

    And for guest/events relation, i’ll go again for many to many / many to many. Take a look at here and ask yourself: one/many type of my entity can have one/many type of another entity?

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

Sidebar

Related Questions

I'm trying to create my own library in a Symfony2 project but I'm having
I am trying create an application which will clone the GIT repository to the
I'm trying to create an entity in Symfony2 that the primary key based on
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
Trying to create a macro which can be used for print debug messages when
i'm trying to create a SQL query in Doctrine 2 (Symfony2 Framework), and i
I'm trying to create a simple index to a table in Doctrine2 / Symfony2
In Symfony2 RC3, I am trying to create a related entity on a User
I am trying create a WCF service that leverages the WPF MediaPlayer on the
I am trying to create a bundle in vendors in Symfony2. MyBundle(MineUserBundle) needs to

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.