I have an Entity that has a column that is both a primary and a foreign key.
use Doctrine\ORM\Mapping as ORM;
/**
* BlacklistedUserIds
*
* @ORM\Table(name="blacklisted_user_ids")
* @ORM\Entity
*/
class BlacklistedUserIds
{
/**
* @var \Orm\Entity\UserAccounts
*
* @Orm\Id @ORM\OneToOne(targetEntity="Orm\Entity\UserAccounts")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="user_account_id", referencedColumnName="id", unique=true)
* })
*/
private $userAccount;
}
Doctrine console does not like this Entity though as it does not seem to recognize @Orm\Id bit in
@Orm\Id @ORM\OneToOne(targetEntity="Orm\Entity\UserAccounts")
Here is my console output
[vagrant@dev api]$ doctrine orm:schema-tool:update --dump-sql
[Doctrine\ORM\Mapping\MappingException]
No identifier/primary key specified for Entity "Orm\Entity\BlacklistedUserIds". Every Entity must have an identifier/primary key.
orm:schema-tool:update [--complete] [--dump-sql] [--force]
According to http://doctrine-orm.readthedocs.org/en/latest/tutorials/composite-primary-keys.html#use-case-1-dynamic-attributes my definition should be totally valid.
What is that I am missing?
Thanks