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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:35:57+00:00 2026-06-02T21:35:57+00:00

I am using the class table inheritance pattern with Doctrine 2.2. My DB schema

  • 0

I am using the class table inheritance pattern with Doctrine 2.2. My DB schema is as follows:

Parent
access_id (primary key)
access_type (discriminator column)
access_role
access_acl
access_primary
user_id (foreign key)

Child 1
access_id (foreign key)
account_id (foreign key)

Child 2
access_id (foreign key)
distributor_id (foreign key)

When I try to insert a new entity into the database, the parent query looks okay, but the child query has an extra parameter. When I dumped the query being executed, this is what I saw:

INSERT INTO user_access_account (access_id, account_id) VALUES (?, ?)   
array('1'=> 39, '2'=> NULL, '3'=> 3 )

The ‘2’ index is extraneous. ‘1’ => 39, ‘2’ => 3 are the correct parameters.

The code used to execute this query is as follows:

$entity = new Entity\UserAccessAccount();
$entity->setAccount($account)
       ->setUser($user)
       ->setAccessRole($accessRole)
       ->setAccessAcl($accessAcl)
       ->setAccessPrimary($accessPrimary);

$em->persist($entity);
$em->flush($entity);
  • 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-02T21:36:00+00:00Added an answer on June 2, 2026 at 9:36 pm

    As it turns out, the auto-generated entity mapping had some data that needed to be deleted. The oneToOne definition from UserAccessAccount back to UserAccess caused Doctrine to believe there was an extra parameter. It makes sense now!

    Correct:

    Entity\UserAccessAccount:
      type: entity
      table: user_access_account
      repositoryClass: Repository\UserAccessAccount
      oneToOne:
        account:
          targetEntity: Entity\Account
          cascade: {  }
          mappedBy: null
          inversedBy: null
          joinColumns:
            account_id:
              referencedColumnName: account_id
          orphanRemoval: false
      lifecycleCallbacks: {  }
    

    Incorrect:

    Entity\UserAccessAccount:
      type: entity
      table: user_access_account
      repositoryClass: Repository\UserAccessAccount
      oneToOne:
        account:
          targetEntity: Entity\Account
          cascade: {  }
          mappedBy: null
          inversedBy: null
          joinColumns:
            account_id:
              referencedColumnName: account_id
          orphanRemoval: false
        userAccess:
          targetEntity: Entity\UserAccess
          cascade: {  }
          mappedBy: null
          inversedBy: null
          joinColumns:
            access_id:
              referencedColumnName: user_access
      lifecycleCallbacks: {  }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Single Table Inheritance for managing different types of projects. Models: class
I'm trying to model a specialization/generalization, leaning towards using class table inheritance (see this
I am using the concrete table inheritance with SQLAlchemy. In declartive style model class,
I am implementing inheritance mapping with D2 using Class Table Inheritance strategy. I have
Using class table inheritance it is recommended that the subclass refers to the superclass
I would like to use form_for except I have class table inheritance models using
I am using single table inheritance in ROR3 so I created these models: class
I have added checkbox in display table using decorator class as shown in below
I have a class that is mapped to a table using NHibernate. The problem
I am using LINQ to SQL with single table inheritance for an audit log.

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.