I have a view, where I mapped 3 fields as the primary key and 2 of those fields are foreign keys
As below:
/**
* @var NotaFiscal
* @ORM\Id
* @ORM\ManyToOne(targetEntity="NotaFiscal", inversedBy="itens")
* @ORM\JoinColumn(name="CODIGO", referencedColumnName="CODIGO")
*/
private $notaFiscal;
/**
* @var Produto
* @ORM\Id
* @ORM\ManyToOne(targetEntity="Produto")
* @ORM\JoinColumn(name="CD_PRODUTO", referencedColumnName="CD_PRODUTO")
*/
private $produto;
/**
* @var string
* @ORM\Id
* @ORM\Column(name="CD_LOTE")
*/
private $lote;
I can not see where the error is ... Single id is not allowed on composite primary key in entity