Note that there are some explanatory texts on larger screens.

plurals
  1. POTriple split mapping issue with Doctrine2
    text
    copied!<p>I'm encountering a strange problem using Doctrine2.</p> <p>I'm getting the following error:</p> <p>doctrine orm:validate-schema</p> <pre><code>[Mapping] FAIL - The entity-class 'EmailVerification' mapping is invalid: * The referenced column name 'id' does not have a corresponding field with this column name on the class 'OurUsers'. [Database] OK - The database schema is in sync with the mapping files. </code></pre> <p>My scenario is as follows:</p> <ul> <li>I have 3 tables sharing a primary key.</li> <li>Table <code>Auth</code> which holds <code>user_id</code> PK.</li> <li>Table <code>OurUsers</code> for which <code>Auth.user_id</code> is shared PK.</li> <li>Table <code>EmailVerification</code> for which <code>OurUsers.user_id</code> is shared PK.</li> <li>I also have <code>NotOurUsers</code> - hence the split.</li> </ul> <p>Entities are declared as follows:</p> <pre><code>/** * @Entity * @Table(name="auth") */ class Auth { /** @Id @Column(type="integer", name="user_id") @GeneratedValue @var int */ private $id; /* ... */ } /** * @Entity * @Table(name="our_users") */ class OurUsers { /** * @Id * @OneToOne(targetEntity="Auth") * @JoinColumn(nullable=false, name="user_id", referencedColumnName="user_id") * @var Auth */ private $id; /* ... */ } /** * @Entity * @Table(name="email_verification") */ class EmailVerification { /** * @Id * @OneToOne(targetEntity="OurUsers") * @JoinColumn(nullable=false, name="user_id", referencedColumnName="user_id") * @var OurUsers */ private $id; /* ... */ } </code></pre> <p>I'm using Dosctrine 2.1.</p> <p><strong>btw</strong> Doctrine 2.2 validates mappings as good, but I get same error at run time as with 2.1.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload