Q:

Doctrine 2.1.4/2.1.5 Unrecognized field trying to implement Many-To-Many with an additional field

I'm trying to solve my problems using Doctrine and implementing a Many-To-Many Association with an additional field.
In more Detail - it looks like this:
Person - Person_Project - Project

One person can be part of several Projects
Several Persons can be part of One Project
Persons have Project-specific Roles

That seems to work gracefully with the following Setup:

3 Doctrine Entities
Person -> OneToMany -> Person_Project
Project -> OneToMany -> Person_Project

Those Associations are all bidirectional and configured as follows:
In Person.php:
/**
 * @Id @GeneratedValue @Column(name="PersonenNr", type="integer")
 */
protected $id;

/**
 * @OneToMany(targetEntity="PersonProject", mappedBy="person", cascade={"PERSIST"})
 */
protected $personProjects = null;

public function __construct() {
    $this->personProjects = new ArrayCollection();
}

public function getProjects() {
    $projects = new ArrayCollection();
    foreach ($this->personProjects as $pp) {
        $projects->add($pp->project);
    }
    return $projects;
}

In Project.php:
/**
 * @Id @Column(name="ProjectId", type="string")
 */
protected $id;

/**
 * @OneToMany(targetEntity="PersonProject", mappedBy="project", cascade={"PERSIST"})
 */
protected $personProjects = null;

public function __construct() {
    $this->personProjects = new ArrayCollection();
}

And in PersonProject.php:
/**
 * @Id
 * @ManyToOne(targetEntity="Person", inversedBy="personProjects")
 * @JoinColumn(name="PersonId", referencedColumnName="PersonId")
 */
protected $person = null;

/**
 * @Id
 * @ManyToOne(targetEntity="Project", inversedBy="personProjects")
 * @JoinColumn(name="ProjectId", referencedColumnName="ProjectId")
 */
protected $project = null;

Now my problem begins when using them. Once I've retrieved a Person-Object from the DB, try to get just any Project that this Person is assigned to and then try to access just any Property of this Project, the following Error is encountered:
Error in File: /usr/share/php/Doctrine/ORM/ORMException.php
Line: 60
Text: Unrecognized field:
Trace:
#0 /usr/share/php/Doctrine/ORM/Persisters/BasicEntityPersister.php(1231): Doctrine\ORM\ORMException::unrecognizedField('')
#1 /usr/share/php/Doctrine/ORM/Persisters/BasicEntityPersister.php(853): Doctrine\ORM\Persisters\BasicEntityPersister->_getSelectConditionSQL(Array, NULL)
#2 /usr/share/php/Doctrine/ORM/Persisters/BasicEntityPersister.php(568): Doctrine\ORM\Persisters\BasicEntityPersister->_getSelectEntitiesSQL(Array, NULL, 0)
#3 /tmp/DBProjectProxy.php(31): Doctrine\ORM\Persisters\BasicEntityPersister->load(Array, Object(DoctrineProxies\DBProjectProxy))
#4 /tmp/DBProjectProxy.php(41): DoctrineProxies\DBProjectProxy->__load()
#5 /home/[...]/project-data.html (12): DoctrineProxies\DBProjectProxy->getName()
... (just our internal call-hierarchy)
{main}

While Debugging I can see that the correct Person_Project-Entities are retrieved, but that all the Projects are replaced by DoctrineProxies. As soon as I try to use any property of them, Doctrine hooks in and initializes the Object with the Data but it encounters the former error.
Could anyone help me out there please?
If any further output/information is needed, please feel free to ask.
Thanks for help!

A:

The problem was caused by the following error:
Our Database contains Capitalized Column-Names, so the line 1591 in Doctrine's BasicEntityPersister couldn't find a Primary Key called "projektkennung" because it is actually called "Projektkennung".
You should DEFINATELY always enter the Column-Names case-sensitive!!
Everything else worked properly and only deep deep debugging could help to figure out the problem.
Thanks at @meze for trying to help me :)

