added a comment - - edited
I am almost done with it - need a little more help from you:
So I fixed the DatabaseDriver so it correctly calls mapOneToOne
and passes association_mapping to it.
/**
* Adds a one-to-one mapping.
*
* @param array $mapping The mapping.
*/
public function mapOneToOne(array $mapping)
{
$mapping['type'] = self::ONE_TO_ONE;
$mapping = $this->_validateAndCompleteOneToOneMapping($mapping);
$this->_storeAssociationMapping($mapping);
print_r($assocMapping); <--added this to see what structure we have on output
}
this gives the following structure
Array
(
[fieldName] => someguid <--- my primary key field, which is also foreign key
[targetEntity] => Additionalinfo <--- target table
[id] => 1 <--- indicates that this mapping is also id (primary key)
[joinColumns] => Array
(
[0] => Array
(
[name] => Someguid <--- join columns
[referencedColumnName] => UniqueID
)
)
[type] => 1 <-- indicates ONE-TO-ONE assoc mapping
[mappedBy] =>
[inversedBy] =>
[isOwningSide] => 1
[sourceEntity] => Sampledata
[fetch] => 2
..... (i omit other data as not important)
)
Now the problem: in my entity I got the following
/**
* @var Additionalinfo
*
* @ORM\OneToOne(targetEntity="Additionalinfo")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="Someguid", referencedColumnName="UniqueID")
* })
*/
private $someguid;
So it correctly created a One-To-One mapping, but it did not preserve @Id attribute.
I guess this is because field_associations and mapping_associations are processed in separate way,
and in mapping_association it ignores the $mapping["id"] setting.
Do you know what code is managing creating the <id ....> / @Id staff - it is common for annotation/yaml/xml, e.x. when i generated xml for entity, it also does not contain <id > tag.
In lib/Doctrine/ORM/Mapping/DatabaseDriver.php