I am trying to update my schema in doctrine using:
php vendor/bin/doctrine orm:schema-tool:update
But I am getting the error message:
[Doctrine\ORM\Mapping\MappingException]
Single id is not allowed on composite primary key in entity entities\Events
The events entity looks like this:
<?php
// entities/Events.php
namespace entities;
use Entities\Enities;
use Doctrine\ORM\Mapping;
use Doctrine\ORM\Mapping\Table;
/**
* @Entity
* @Table(name="development.events")
**/
class Events extends Entities {
/**
* @var integer
*
* @Id
* @Column(name="id", type="integer")
* @GeneratedValue(strategy="AUTO")
*/
protected $event_id;
/**
* @var integer
*
* @Id
* @Column(name="app_id", type="integer")
*/
protected $app_id = 0;
/**
* @var string
* @Column(type="string", length=64)
*/
protected $post_title;
public function __construct($event, $app){
$this->event_id = $event;
$this->app_id= $app;
}
}
According to documentation, composite keys are natively supported. http://doctrine-orm.readthedocs.org/projects/doctrine-orm/en/latest/tutorials/composite-primary-keys.html What am I doing wrong?
From the docs:
So remove
@GeneratedValue(strategy="AUTO")
.