I have a table with a composite primary key. For historic reasons (pre 
DDC-117) this is implemented as a simple PK plus a unique index:

/**
 * @Entity
 * @Table(
 *         name="test",
 *         uniqueConstraints={
 *             @UniqueConstraint(name="test_unique", columns={"entity_id", 
"pkey"})
 *         }
 * )
 */
class Test {
    /**
     * @Id
     * @Column(type="integer", nullable=false)
     * @GeneratedValue(strategy="AUTO")
     *
     * @todo wait until DDC-117 is fixed (PKs on FKs)
     */
    protected $id;

    /**
     * @Column(name="pkey", type="string", nullable=false)
     * HINT: column name "key" is reserved by mysql
     */
    protected $key;

    /**
     * @ManyToOne(targetEntity="Entity", inversedBy="test")
     */
    protected $entity;


As we're running on embedded platforms like RasPi, performance is critical. 
Trying to imlement a composite primary key I'm running into errors from 
http://www.doctrine-project.org/jira/browse/DBAL-464 (which should have 
been fixed as of 2.51):

/**
 * @Entity
 * @Table(
 *         name="test",
 *         uniqueConstraints={
 *             @UniqueConstraint(name="test_unique", columns={"entity_id", 
"pkey"})
 *         }
 * )
 */
class Test {
    /**
     * @Id
     * @Column(name="pkey", type="string", nullable=false)
     */
    protected $key;

    /**
     * @Id
     * @ManyToOne(targetEntity="Entity", inversedBy="test")
     */
    protected $entity;

>php misc\tools\doctrine orm:schema-tool:update --dump-sql

ALTER TABLE test DROP PRIMARY KEY;
ALTER TABLE test DROP id, CHANGE entity_id entity_id INT NOT NULL;
ALTER TABLE test ADD PRIMARY KEY (pkey, entity_id);

>php misc\tools\doctrine orm:schema-tool:update --force

  [Doctrine\DBAL\Driver\PDOException]
  SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table 
definition; there can be only one auto column and it must be defined as a 
key

Apparently the solution for DBAL-464 is not in place:

> The answer is to remove "auto increment" attribut of primary key column 
juste before try to drop the primary key itself.

Please advise why DBAL-464 is not working for me.

Cheers, 
Andreas

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to